From 06b2ef03bed3ad74135d8227b3d340c9c96088fa Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 12:46:47 +0100 Subject: [PATCH 1/6] debug: test if concurrency works --- .github/workflows/on-release.yml | 48 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 02a066be6b..d513a990e3 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -3,20 +3,26 @@ on: push: branches: - main + - feat/fix-doc-latest-alias workflow_dispatch: {} jobs: publish: + ######################### + # Ensure that we only a single job (with the same group) will run at a time + # This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` + ######################### + concurrency: + group: on-release-publish runs-on: ubuntu-latest - steps: - name: "Checkout" uses: actions/checkout@v2 with: token: ${{ secrets.GH_PUBLISH_TOKEN }} fetch-depth: 0 - ######################### - # Release new version - ######################### + ######################### + # Release new version + ######################### - name: "Use NodeJS 14" uses: actions/setup-node@v2 with: @@ -32,30 +38,30 @@ 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 - ######################### - # Generate documentation - ######################### + # 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 + ######################### - name: Set up Python uses: actions/setup-python@v2.3.1 with: python-version: '3.8' - name: Set RELEASE_VERSION env var run: | - RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r) + RELEASE_VERSION=$(cat lerna.json | jq '.version' -r) echo "RELEASE_VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV - name: Install doc generation dependencies run: | From 0c0aace8df2d85407d1ba890cd451a568a2825b5 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 12:47:49 +0100 Subject: [PATCH 2/6] debug: test concurrency (2) From 43f871197612aa3295cba10b202448b78a1cb729 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 13:36:01 +0100 Subject: [PATCH 3/6] fix: also publish to main --- .github/workflows/on-release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index d513a990e3..739ebe415b 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -77,7 +77,11 @@ jobs: VERSION="$RELEASE_VERSION" ALIAS="latest" mkdocs build - mike deploy --push --update-aliases "$VERSION" "$ALIAS" + mike deploy --push --update-aliases --no-redirect "$VERSION" "$ALIAS" + # Once we have agreed on release process, we will also use "main" + # to track the latest development version. For now, we make it the same + # as the latest version. + mike deploy --push --update-aliases --no-redirect "main" "$ALIAS" # Set latest version as a default mike set-default --push latest - name: Build API docs From 4394820d355ccbd6ec5de420161b4dd01d35c675 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 13:46:30 +0100 Subject: [PATCH 4/6] fix: remove conflict from merge --- .github/workflows/on-release.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index b526e5526d..d621ff7373 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -61,13 +61,8 @@ jobs: python-version: '3.8' - name: Set RELEASE_VERSION env var run: | -<<<<<<< HEAD - RELEASE_VERSION=$(cat lerna.json | jq '.version' -r) - echo "RELEASE_VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV -======= RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r) echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV ->>>>>>> main - name: Install doc generation dependencies run: | pip install --upgrade pip From 4b015606966ee8bee2c4002f4c0eb9db99ef0c9e Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 13:56:13 +0100 Subject: [PATCH 5/6] switch back to watch main branch and actually release a version --- .github/workflows/on-release.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index d621ff7373..8d0fe70902 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -3,7 +3,6 @@ on: push: branches: - main - - feat/fix-doc-latest-alias workflow_dispatch: {} jobs: publish: @@ -38,20 +37,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 49a828100bffb3914d7172a2410ae24a8ae1880c Mon Sep 17 00:00:00 2001 From: ijemmy Date: Wed, 29 Dec 2021 14:03:32 +0100 Subject: [PATCH 6/6] fix: fix grammar in comments --- .github/workflows/on-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 8d0fe70902..7d5604fd48 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -7,8 +7,8 @@ on: jobs: publish: ######################### - # Ensure that we only a single job (with the same group) will run at a time - # This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` + # Force Github action to run only a single job at a time (based on the group name) + # This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` (#365) ######################### concurrency: group: on-release-publish @@ -79,8 +79,8 @@ jobs: mkdocs build mike deploy --push --update-aliases --no-redirect "$VERSION" "$ALIAS" # Once we have agreed on release process, we will also use "main" - # to track the latest development version. For now, we make it the same - # as the latest version. + # to track the development version (on main branch). + # For now, we make it the same as the latest version. mike deploy --push --update-aliases --no-redirect "main" "$ALIAS" # Set latest version as a default mike set-default --push latest