From 2ac07ba0f3549bc6aa03bcaddac70897424141c8 Mon Sep 17 00:00:00 2001 From: Dylan Kelly Date: Wed, 16 Oct 2024 14:49:58 +1100 Subject: [PATCH 1/2] chore: :wrench: update publish config to handle draft releases --- .github/workflows/publish.yml | 42 ++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 165faaed6a..a8aca0eb78 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,12 +28,48 @@ jobs: CYPRESS_INSTALL_BINARY: 0 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 run: pnpm install --frozen-lockfile - - name: Publish release + + - name: Bump versions for proper release + if: ${{ !context.payload.release.draft }} + run: npm run release:version ${{ !context.payload.release.name }} --yes + + - name: Run release:changelog script for proper release + if: ${{ !context.payload.release.draft }} + run: npm run release:changelog + + - name: Configure Git + if: ${{ !context.payload.release.draft }} + run: | + git config --global user.email "sdp.devs@dpc.vic.gov.au" + git config --global user.name "SDP Deploy" + + - name: Commit changes + if: ${{ !context.payload.release.draft }} + run: | + git add . + git commit -m "chore: release ${{ !context.payload.release.name }}" + + - name: Push changes + if: ${{ !context.payload.release.draft }} + run: | + git push origin ${{ github.ref }} # Pushes back to the same branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish draft release as alpha + if: ${{ context.payload.release.draft }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pnpm config set access public + pnpm release:publish-alpha --yes + + - name: Publish proper release + if: ${{ !context.payload.release.draft }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git config --global user.email "sdp.devs@dpc.vic.gov.au" - git config --global user.name "SDP Deploy" pnpm config set access public pnpm run release:publish --yes From 61f9b6dd8b8199fedd031b3401077589ba6c33e5 Mon Sep 17 00:00:00 2001 From: dylankelly Date: Wed, 16 Oct 2024 14:57:48 +1100 Subject: [PATCH 2/2] chore: fix syntax of release workflow --- .github/workflows/publish.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a8aca0eb78..39a1a5fcc6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,34 +30,34 @@ jobs: run: pnpm install --frozen-lockfile - name: Bump versions for proper release - if: ${{ !context.payload.release.draft }} - run: npm run release:version ${{ !context.payload.release.name }} --yes + if: ${{ !github.event.release.prerelease }} + run: npm run release:version ${{ !github.event.release.name }} --yes - name: Run release:changelog script for proper release - if: ${{ !context.payload.release.draft }} + if: ${{ !github.event.release.prerelease }} run: npm run release:changelog - name: Configure Git - if: ${{ !context.payload.release.draft }} + if: ${{ !github.event.release.prerelease }} run: | git config --global user.email "sdp.devs@dpc.vic.gov.au" git config --global user.name "SDP Deploy" - name: Commit changes - if: ${{ !context.payload.release.draft }} + if: ${{ !github.event.release.prerelease }} run: | git add . - git commit -m "chore: release ${{ !context.payload.release.name }}" + git commit -m "chore: release ${{ !github.event.release.name }}" - name: Push changes - if: ${{ !context.payload.release.draft }} + if: ${{ !github.event.release.prerelease }} run: | git push origin ${{ github.ref }} # Pushes back to the same branch env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish draft release as alpha - if: ${{ context.payload.release.draft }} + if: ${{ github.event.release.prerelease }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -66,7 +66,7 @@ jobs: pnpm release:publish-alpha --yes - name: Publish proper release - if: ${{ !context.payload.release.draft }} + if: ${{ !github.event.release.prerelease }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}