From 48a6c6de60fad6fdb13e284582d1664eba1405ae Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 14:51:58 -0500 Subject: [PATCH 1/7] Update branch to main & per-PR concurrency --- .github/workflows/preview-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index c68dc7d..953d8ea 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -1,7 +1,7 @@ name: Preview docs on: pull_request: - branches: production + branches: 'main' paths: - docs/** - '*rc' @@ -10,7 +10,7 @@ on: - '*.lock' - .github/workflows/preview-docs.yml concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true jobs: preview-docs: From 91c6a835fea46853854452664ee8e8c3f6d93375 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 14:52:36 -0500 Subject: [PATCH 2/7] Queue, but don't cancel & use GH if statements --- .github/workflows/publish-npm.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 270cb83..138ad0b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -3,9 +3,7 @@ on: release: types: [published, prereleased] workflow_dispatch: -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true +concurrency: ${{ github.workflow }} jobs: publish-npm: runs-on: ubuntu-latest @@ -17,12 +15,11 @@ jobs: registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm test - - name: Publish to npm - run: | - if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then - npm publish --tag next --access public - else - npm publish --access public - fi + - if: '!github.event.release.prerelease' + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + - if: github.event.release.prerelease + run: npm publish --tag next --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} From dd8e4f30023576d39c947962a32404bf7c950e5a Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 14:52:48 -0500 Subject: [PATCH 3/7] Use beta tag to align with convention --- .github/workflows/publish-npm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 138ad0b..7ccc9bc 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -20,6 +20,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - if: github.event.release.prerelease - run: npm publish --tag next --access public + run: npm publish --tag beta --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} From d7409d1e22a08012725243c736b033defdf188ad Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 14:53:04 -0500 Subject: [PATCH 4/7] Switch to main name --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22a899b..dbd452a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: push: - branches: 'production' + branches: 'main' paths: - src/** - test/** @@ -10,7 +10,7 @@ on: - '*.json' - .github/workflows/test.yml pull_request: - branches: 'production' + branches: 'main' paths: - src/** - test/** @@ -19,7 +19,7 @@ on: - '*.json' - .github/workflows/test.yml concurrency: - group: test-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true jobs: test: From 0c842adb598a4ccf913bcd095cc62d59c16835d3 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 14:53:31 -0500 Subject: [PATCH 5/7] Remove redundant publish trigger --- .github/workflows/publish-npm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 7ccc9bc..70a13ff 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,7 +1,7 @@ name: Publish npm on: release: - types: [published, prereleased] + types: published workflow_dispatch: concurrency: ${{ github.workflow }} jobs: From f9045386756526a419141d9a1738a88a7c3ab42a Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 15:31:27 -0500 Subject: [PATCH 6/7] Switch to an either-or job --- .github/workflows/publish-npm.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 70a13ff..8fc5a2b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -5,7 +5,8 @@ on: workflow_dispatch: concurrency: ${{ github.workflow }} jobs: - publish-npm: + publish-npm-release: + if: '!github.event.release.prerelease' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,11 +16,23 @@ jobs: registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm test - - if: '!github.event.release.prerelease' - run: npm publish --access public + - run: | + npm publish + npm dist-tag add "$(npm view . name)@$(npm view . version)" next env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - - if: github.event.release.prerelease - run: npm publish --tag beta --access public + publish-npm-prerelease: + if: github.event.release.prerelease + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + cache: npm + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: | + npm publish --tag beta + npm dist-tag add "$(npm view . name)@$(npm view . version)" next env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} From 6dd2785c39ac2de018b86c64e090ee3bf2d15ce4 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 7 Jun 2023 15:37:38 -0500 Subject: [PATCH 7/7] Back to one workflow --- .github/workflows/publish-npm.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 8fc5a2b..1838e70 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -5,8 +5,7 @@ on: workflow_dispatch: concurrency: ${{ github.workflow }} jobs: - publish-npm-release: - if: '!github.event.release.prerelease' + publish-npm: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,23 +15,10 @@ jobs: registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm test - - run: | - npm publish - npm dist-tag add "$(npm view . name)@$(npm view . version)" next + - run: npm publish --tag next env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - publish-npm-prerelease: - if: github.event.release.prerelease - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - cache: npm - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: | - npm publish --tag beta - npm dist-tag add "$(npm view . name)@$(npm view . version)" next + - if: '!github.event.release.prerelease' + run: npm dist-tag add "$(npm view . name)@$(npm view . version)" latest env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}