From 56ae888462804eb599dfc8f411b16921fc26790c Mon Sep 17 00:00:00 2001 From: cheton Date: Tue, 10 Sep 2024 22:55:48 +0800 Subject: [PATCH] ci: correct Tonic UI documentation URL --- .github/workflows/ci-branch.yml | 2 +- .github/workflows/ci-pr.yml | 12 ++++++------ .github/workflows/ci-tag.yml | 2 +- packages/react-docs/components/Header.js | 8 +++----- packages/react-docs/tonic-ui.env | 14 +++++++------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci-branch.yml b/.github/workflows/ci-branch.yml index d3dbe45186..7533731384 100644 --- a/.github/workflows/ci-branch.yml +++ b/.github/workflows/ci-branch.yml @@ -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 diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index e3c1c1858e..a51732f80c 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -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 @@ -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` @@ -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" diff --git a/.github/workflows/ci-tag.yml b/.github/workflows/ci-tag.yml index 773bf28db4..37f02fe072 100644 --- a/.github/workflows/ci-tag.yml +++ b/.github/workflows/ci-tag.yml @@ -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 diff --git a/packages/react-docs/components/Header.js b/packages/react-docs/components/Header.js index 49c6bbb557..78a761c7ec 100644 --- a/packages/react-docs/components/Header.js +++ b/packages/react-docs/components/Header.js @@ -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-, 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), }, }; diff --git a/packages/react-docs/tonic-ui.env b/packages/react-docs/tonic-ui.env index b286ffe66b..c83dc55f8b 100755 --- a/packages/react-docs/tonic-ui.env +++ b/packages/react-docs/tonic-ui.env @@ -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}