From ffff59b729e7387886dbad8266960e603c810640 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:06:34 +0100 Subject: [PATCH 01/12] fix: delete on-docs-change.yml as it's duplicated with on-release.yml now --- .github/workflows/on-docs-change.yml | 58 ---------------------------- .github/workflows/on-release.yml | 28 +++++++------- 2 files changed, 14 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/on-docs-change.yml diff --git a/.github/workflows/on-docs-change.yml b/.github/workflows/on-docs-change.yml deleted file mode 100644 index c159eebc62..0000000000 --- a/.github/workflows/on-docs-change.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: on-docs-change - -on: - push: - branches: - - main - paths: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - 'mkdocs.yml' - - '.github/workflows/on-docs-change.yml' - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v2.3.1 - with: - python-version: '3.8' - - name: Set up NodeJS - uses: actions/setup-node@v2 - with: - node-version: '17.2' - - name: "Setup npm" - run: | - npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" - - name: Install dependencies - run: | - pip install --upgrade pip - pip install -r docs/requirements.txt - npm ci - - name: Setup doc deploy - run: | - git config --global user.name Docs deploy - git config --global user.email docs@dummy.bot.com - - name: Build mkdocs site in "gh-pages" branch and push - run: | - rm -rf site - VERSION="main" - ALIAS="stage" - mkdocs build - mike deploy --push --update-aliases "$VERSION" "$ALIAS" - - name: Build API documentation site - run: | - rm -rf api - npm run docs-generateApiDoc - - name: Release API docs to the main version - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./api - keep_files: true - destination_dir: main/api \ No newline at end of file diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 02a066be6b..f1a724a41b 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,7 @@ name: release on: push: branches: - - main + - feat/gen-doc-on-release workflow_dispatch: {} jobs: publish: @@ -32,20 +32,20 @@ jobs: run: npm run lerna-lint - name: Run tests run: npm run lerna-test - - name: "Version and publish" - env: - GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY + # - name: "Version and publish" + # env: + # GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} + # run: | + # git config --global user.name 'github-actions[bot]' + # git config --global user.email 'github-actions[bot]@users.noreply.github.com' + # git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY - if [ ${{ github.base_ref }} = main ]; then - npx lerna version --conventional-commits --create-release github --force-publish=* --yes - else - npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes - fi - npx lerna publish from-git --no-verify-access --yes + # if [ ${{ github.base_ref }} = main ]; then + # npx lerna version --conventional-commits --create-release github --force-publish=* --yes + # else + # npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes + # fi + # npx lerna publish from-git --no-verify-access --yes ######################### # Generate documentation ######################### From 0bbeb88b81a9e8275dc019754933862a7b6164a2 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:07:25 +0100 Subject: [PATCH 02/12] debug: echo release version to check why leading 0 is missing --- .github/workflows/on-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index f1a724a41b..a3f4c5b95b 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -67,6 +67,7 @@ jobs: git config --global user.email docs@dummy.bot.com - name: Build mkdocs site in "gh-pages" branch and push run: | + echo "RELEASE_VERSION = $RELEASE_VERSION" rm -rf site VERSION="$RELEASE_VERSION" ALIAS="latest" From 531d580c0d92da74e58446fe29189c14fa70797b Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:11:57 +0100 Subject: [PATCH 03/12] fix: change branch name --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index a3f4c5b95b..98a5cb7716 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,7 @@ name: release on: push: branches: - - feat/gen-doc-on-release + - fix/remove-on-docs-change-workflow workflow_dispatch: {} jobs: publish: From f22ee5a304c4e3ab95712a7524dc93134c9d8ffc Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:16:30 +0100 Subject: [PATCH 04/12] debug: find why leading 0 disappears in the RELEASE_VERSION --- .github/workflows/on-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 98a5cb7716..aef7af850e 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -56,6 +56,7 @@ jobs: - name: Set RELEASE_VERSION env var run: | RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r) + echo "RELEASE_VERSION = $RELEASE_VERSION" echo "RELEASE_VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV - name: Install doc generation dependencies run: | From a58474009d8862722e2575f6a0ac114026b89f38 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:21:43 +0100 Subject: [PATCH 05/12] debug: fix leading 0 disappears in the RELEASE_VERSION --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index aef7af850e..ba6686778e 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -57,7 +57,7 @@ jobs: run: | RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r) echo "RELEASE_VERSION = $RELEASE_VERSION" - echo "RELEASE_VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV - name: Install doc generation dependencies run: | pip install --upgrade pip From b07c2dfcb68baccc52d12c0f4bc9f6ba7340d28b Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:27:53 +0100 Subject: [PATCH 06/12] debug: test different syntx --- .github/workflows/on-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index ba6686778e..bd714f3e1f 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -68,10 +68,10 @@ jobs: git config --global user.email docs@dummy.bot.com - name: Build mkdocs site in "gh-pages" branch and push run: | - echo "RELEASE_VERSION = $RELEASE_VERSION" rm -rf site - VERSION="$RELEASE_VERSION" + VERSION="${{ env.GITHUB_SHA_SHORT }}" ALIAS="latest" + echo "VERSION = $VERSION" mkdocs build mike deploy --push --update-aliases "$VERSION" "$ALIAS" # Set latest version as a default From 0aaa09a37a0b508e853b0e4b08ed1d8d3d5aca21 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:28:57 +0100 Subject: [PATCH 07/12] debug: test different syntx2 --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index bd714f3e1f..4864bd8801 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -69,7 +69,7 @@ jobs: - name: Build mkdocs site in "gh-pages" branch and push run: | rm -rf site - VERSION="${{ env.GITHUB_SHA_SHORT }}" + VERSION="${{ env.RELEASE_VERSION }}" ALIAS="latest" echo "VERSION = $VERSION" mkdocs build From 6e1925449f71a442aa390e22342c37cd25a31894 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:34:32 +0100 Subject: [PATCH 08/12] debug: restor branch back to main --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 4864bd8801..5977c92aef 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,7 @@ name: release on: push: branches: - - fix/remove-on-docs-change-workflow + - main workflow_dispatch: {} jobs: publish: From cc192df6d13fca20d4d8b53f17454fc7fb0bbf69 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:35:55 +0100 Subject: [PATCH 09/12] debug: restore publishing new version --- .github/workflows/on-release.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 5977c92aef..c0505eb3a8 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -32,20 +32,20 @@ jobs: run: npm run lerna-lint - name: Run tests run: npm run lerna-test - # - name: "Version and publish" - # env: - # GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} - # run: | - # git config --global user.name 'github-actions[bot]' - # git config --global user.email 'github-actions[bot]@users.noreply.github.com' - # git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY + - name: "Version and publish" + env: + GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY - # if [ ${{ github.base_ref }} = main ]; then - # npx lerna version --conventional-commits --create-release github --force-publish=* --yes - # else - # npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes - # fi - # npx lerna publish from-git --no-verify-access --yes + if [ ${{ github.base_ref }} = main ]; then + npx lerna version --conventional-commits --create-release github --force-publish=* --yes + else + npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes + fi + npx lerna publish from-git --no-verify-access --yes ######################### # Generate documentation ######################### @@ -56,7 +56,6 @@ jobs: - name: Set RELEASE_VERSION env var run: | RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r) - echo "RELEASE_VERSION = $RELEASE_VERSION" echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV - name: Install doc generation dependencies run: | @@ -71,7 +70,7 @@ jobs: rm -rf site VERSION="${{ env.RELEASE_VERSION }}" ALIAS="latest" - echo "VERSION = $VERSION" + echo "Publishing doc for version: $VERSION" mkdocs build mike deploy --push --update-aliases "$VERSION" "$ALIAS" # Set latest version as a default From 702f36528293330d505ebc11fc861b4c71936227 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:36:12 +0100 Subject: [PATCH 10/12] debug: restore publishing new version --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index c0505eb3a8..0595c2f547 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,7 @@ name: release on: push: branches: - - main + - fix/remove-on-docs-change-workflow workflow_dispatch: {} jobs: publish: From 89904c732b4cd68bf6f07b62f5e9159de90e02e8 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:36:41 +0100 Subject: [PATCH 11/12] debug: final check before creating PR --- .github/workflows/on-release.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 0595c2f547..6a17b503f2 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -32,20 +32,20 @@ jobs: run: npm run lerna-lint - name: Run tests run: npm run lerna-test - - name: "Version and publish" - env: - GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY + # - name: "Version and publish" + # env: + # GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} + # run: | + # git config --global user.name 'github-actions[bot]' + # git config --global user.email 'github-actions[bot]@users.noreply.github.com' + # git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY - if [ ${{ github.base_ref }} = main ]; then - npx lerna version --conventional-commits --create-release github --force-publish=* --yes - else - npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes - fi - npx lerna publish from-git --no-verify-access --yes + # if [ ${{ github.base_ref }} = main ]; then + # npx lerna version --conventional-commits --create-release github --force-publish=* --yes + # else + # npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes + # fi + # npx lerna publish from-git --no-verify-access --yes ######################### # Generate documentation ######################### From febf608484ff357487ae7ea85fed14aa55036918 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 28 Dec 2021 15:43:07 +0100 Subject: [PATCH 12/12] debug: restore publishing new version + trigger on main branch --- .github/workflows/on-release.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 6a17b503f2..c0505eb3a8 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,7 @@ name: release on: push: branches: - - fix/remove-on-docs-change-workflow + - main workflow_dispatch: {} jobs: publish: @@ -32,20 +32,20 @@ jobs: run: npm run lerna-lint - name: Run tests run: npm run lerna-test - # - name: "Version and publish" - # env: - # GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} - # run: | - # git config --global user.name 'github-actions[bot]' - # git config --global user.email 'github-actions[bot]@users.noreply.github.com' - # git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY + - name: "Version and publish" + env: + GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY - # if [ ${{ github.base_ref }} = main ]; then - # npx lerna version --conventional-commits --create-release github --force-publish=* --yes - # else - # npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes - # fi - # npx lerna publish from-git --no-verify-access --yes + if [ ${{ github.base_ref }} = main ]; then + npx lerna version --conventional-commits --create-release github --force-publish=* --yes + else + npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes + fi + npx lerna publish from-git --no-verify-access --yes ######################### # Generate documentation #########################