From ca5208196a60ef6c9734ec30651d6e8e9c6cdd05 Mon Sep 17 00:00:00 2001 From: Brynley Llewellyn-Roux Date: Thu, 4 Jul 2024 13:14:57 +1000 Subject: [PATCH] ci: fix tagging deployment --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04a625847..2374ea449 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,26 @@ jobs: name: cobertura-coverage path: tmp/coverage/cobertura-coverage.json + build-prerelease: + name: "Build / Pre-release" + runs-on: ubuntu-latest + needs: + - check-lint + - check-build + - check-test + if: > + startsWith(github.ref, 'refs/tags/v') && + contains(github.ref, '-') + steps: + - uses: actions/checkout@v4 + - name: Run deployment + run: | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc + echo 'Publishing library prerelease' + npm install + npm publish --tag prerelease --access public + rm -f ./.npmrc + build-pull: name: "Build / Pull Request" runs-on: ubuntu-latest @@ -102,7 +122,10 @@ jobs: - check-lint - check-build - check-test - if: github.ref == 'refs/heads/staging' + if: > + github.ref == 'refs/heads/staging' || + (startsWith(github.ref, 'refs/tags/v') && + !contains(github.ref, '-')) steps: - uses: actions/checkout@v4 - name: Create pull request @@ -121,26 +144,6 @@ jobs: --body-file - \ --repo "$GITHUB_REPOSITORY" - build-prerelease: - name: "Build / Pre-release" - runs-on: ubuntu-latest - needs: - - check-lint - - check-build - - check-test - if: > - startsWith(github.ref, 'refs/tags/v') && - contains(github.ref, '-') - steps: - - uses: actions/checkout@v4 - - name: Run deployment - run: | - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc - echo 'Publishing library prerelease' - npm install - npm publish --tag prerelease --access public - rm -f ./.npmrc - integration-merge: name: "Integration / Merge" runs-on: ubuntu-latest @@ -148,7 +151,10 @@ jobs: group: integration-merge cancel-in-progress: true needs: build-pull - if: github.ref == 'refs/heads/staging' + if: > + github.ref == 'refs/heads/staging' || + (startsWith(github.ref, 'refs/tags/v') && + !contains(github.ref, '-')) steps: - uses: actions/checkout@v4 with: