Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: correct Tonic UI documentation URL #921

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
echo "CI_COMMIT=${{ github.sha }}" >> $GITHUB_ENV
echo "MATOMO_URL=//matomo.xdr.trendmicro.com" >> $GITHUB_ENV
echo "MATOMO_CONTAINER_ID=N8rpl9LU" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui/react-docs/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui/react/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_VERSION=${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV

# $GITHUB_OUTPUT is shared between all steps in a job
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
echo "CI_PULL_REQUEST_NUMBER=${{ github.event.number }}" >> $GITHUB_ENV
echo "MATOMO_URL=//matomo.xdr.trendmicro.com" >> $GITHUB_ENV
echo "MATOMO_CONTAINER_ID=N8rpl9LU" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui-demo/react-docs/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui-demo/react/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_VERSION=${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV

# $GITHUB_OUTPUT is shared between all steps in a job
Expand Down Expand Up @@ -138,10 +138,10 @@ jobs:

- name: Deploy to gh-pages
run: |
rm -rf "react-docs/${TONIC_UI_REACT_DOCS_VERSION}"
mkdir -p "react-docs/${TONIC_UI_REACT_DOCS_VERSION}"
cp -af artifact/react-docs/** "react-docs/${TONIC_UI_REACT_DOCS_VERSION}/"
git add "react-docs/${TONIC_UI_REACT_DOCS_VERSION}"
rm -rf "react/${TONIC_UI_REACT_DOCS_VERSION}"
mkdir -p "react/${TONIC_UI_REACT_DOCS_VERSION}"
cp -af artifact/react-docs/** "react/${TONIC_UI_REACT_DOCS_VERSION}/"
git add "react/${TONIC_UI_REACT_DOCS_VERSION}"
git commit -m "Deploy ${TONIC_UI_REACT_DOCS_VERSION} to gh-pages [skip ci]"
git push origin gh-pages
GIT_LOG_LAST_COMMIT_DATE=`git log --pretty=%ci -n 1`
Expand All @@ -152,4 +152,4 @@ jobs:
--owner trendmicro-frontend \
--repo tonic-ui \
--issue-number ${CI_PULL_REQUEST_NUMBER} \
--comment "## Tonic UI Demo\nOn ${GIT_LOG_LAST_COMMIT_DATE}, PR #${CI_PULL_REQUEST_NUMBER} (${CI_COMMIT}) was successfully deployed. You can view it at the following link:\n${TONIC_UI_DEMO_PAGES_URL}/react-docs/${TONIC_UI_REACT_DOCS_VERSION}/\n"
--comment "## Tonic UI Demo\nOn ${GIT_LOG_LAST_COMMIT_DATE}, PR #${CI_PULL_REQUEST_NUMBER} (${CI_COMMIT}) was successfully deployed. You can view it at the following link:\n${TONIC_UI_DEMO_PAGES_URL}/react/${TONIC_UI_REACT_DOCS_VERSION}/\n"
2 changes: 1 addition & 1 deletion .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
echo "CI_COMMIT=${{ github.sha }}" >> $GITHUB_ENV
echo "MATOMO_URL=//matomo.xdr.trendmicro.com" >> $GITHUB_ENV
echo "MATOMO_CONTAINER_ID=N8rpl9LU" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui/react-docs/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_BASE_PATH=/tonic-ui/react/${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV
echo "TONIC_UI_REACT_DOCS_VERSION=${TONIC_UI_REACT_VERSION}" >> $GITHUB_ENV

# $GITHUB_OUTPUT is shared between all steps in a job
Expand Down
8 changes: 3 additions & 5 deletions packages/react-docs/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,21 @@ const BASE_PATH = ensureString(process.env.TONIC_UI_REACT_DOCS_BASE_PATH);

const GITHUB_REPO_URL = 'https://github.com/trendmicro-frontend/tonic-ui';

const TONIC_UI_REACT_DOCS_URL = ensureString(process.env.TONIC_UI_REACT_DOCS_URL);

// The TONIC_UI_REACT_DOCS_VERSION environment variable might be one of: latest, pr-<number>, or version (e.g. 0.1.0) for a tag release
const TONIC_UI_REACT_DOCS_VERSION = ensureString(process.env.TONIC_UI_REACT_DOCS_VERSION);

const versionMap = {
'v2': {
label: 'v2',
url: `${TONIC_UI_REACT_DOCS_URL}/v2/getting-started`,
url: ensureString(process.env.TONIC_UI_V2_DOCUMENTATION),
},
'v1': {
label: 'v1',
url: `${TONIC_UI_REACT_DOCS_URL}/v1/getting-started`,
url: ensureString(process.env.TONIC_UI_V1_DOCUMENTATION),
},
'v0': {
label: 'v0',
url: `${TONIC_UI_REACT_DOCS_URL}/v0/getting-started`,
url: ensureString(process.env.TONIC_UI_V0_DOCUMENTATION),
},
};

Expand Down
14 changes: 7 additions & 7 deletions packages/react-docs/tonic-ui.env
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#!/usr/bin/env bash

export TONIC_UI_REACT_DOCS_BASE_PATH=${TONIC_UI_REACT_DOCS_BASE_PATH}
export TONIC_UI_REACT_DOCS_URL=https://trendmicro-frontend.github.io/tonic-ui/react-docs
export TONIC_UI_REACT_DOCS_URL=https://trendmicro-frontend.github.io/tonic-ui
export TONIC_UI_REACT_DOCS_VERSION=${TONIC_UI_REACT_DOCS_VERSION:-v2-dev}
export TONIC_UI_REACT_PACKAGE_VERSION=$(node -p "require('../react/package.json').version")
export TONIC_UI_REPO_ROOT=https://github.com/trendmicro-frontend/tonic-ui

# v2
export TONIC_UI_V2_BRANCH=v2
export TONIC_UI_V2_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/v2
export TONIC_UI_V2_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/v2
export TONIC_UI_V2_SOURCE_CODE=${TONIC_UI_REPO_ROOT}/tree/${TONIC_UI_V2_BRANCH}
export TONIC_UI_V2_TAGNAME=$(git -c 'versionsort.suffix=-' tag --list '@tonic-ui/react@2.*' --sort="-version:refname" | head -n 1)
export TONIC_UI_V2_RELEASE_VERSION=$(echo $TONIC_UI_V2_TAGNAME | awk -F@ '{ print $3 }')
export TONIC_UI_V2_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/${TONIC_UI_V2_RELEASE_VERSION}
export TONIC_UI_V2_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/${TONIC_UI_V2_RELEASE_VERSION}
export TONIC_UI_V2_RELEASE_NOTES=${TONIC_UI_REPO_ROOT}/releases/tag/${TONIC_UI_V2_TAGNAME}

# v1
export TONIC_UI_V1_BRANCH=v1
export TONIC_UI_V1_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/v1
export TONIC_UI_V1_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/v1
export TONIC_UI_V1_SOURCE_CODE=${TONIC_UI_REPO_ROOT}/tree/${TONIC_UI_V1_BRANCH}
export TONIC_UI_V1_TAGNAME=$(git -c 'versionsort.suffix=-' tag --list '@tonic-ui/react@1.*' --sort="-version:refname" | head -n 1)
export TONIC_UI_V1_RELEASE_VERSION=$(echo $TONIC_UI_V1_TAGNAME | awk -F@ '{ print $3 }')
export TONIC_UI_V1_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/${TONIC_UI_V1_RELEASE_VERSION}
export TONIC_UI_V1_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/${TONIC_UI_V1_RELEASE_VERSION}
export TONIC_UI_V1_RELEASE_NOTES=${TONIC_UI_REPO_ROOT}/releases/tag/${TONIC_UI_V1_TAGNAME}

# v0
export TONIC_UI_V0_BRANCH=v0
export TONIC_UI_V0_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/v0
export TONIC_UI_V0_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/v0
export TONIC_UI_V0_SOURCE_CODE=${TONIC_UI_REPO_ROOT}/tree/${TONIC_UI_V0_BRANCH}
export TONIC_UI_V0_TAGNAME=$(git -c 'versionsort.suffix=-' tag --list '@trendmicro/react-styled-ui@0.*' --sort="-version:refname" | head -n 1)
export TONIC_UI_V0_RELEASE_VERSION=$(echo $TONIC_UI_V0_TAGNAME | awk -F@ '{ print $3 }')
export TONIC_UI_V0_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/${TONIC_UI_V0_RELEASE_VERSION}
export TONIC_UI_V0_RELEASE_DOCUMENTATION=${TONIC_UI_REACT_DOCS_URL}/react/${TONIC_UI_V0_RELEASE_VERSION}
export TONIC_UI_V0_RELEASE_NOTES=${TONIC_UI_REPO_ROOT}/releases/tag/${TONIC_UI_V0_TAGNAME}
Loading