From 1e4a887522f3c440693b3032dafb85a4ca5b449f Mon Sep 17 00:00:00 2001 From: Herbert Kavuma Date: Wed, 2 Oct 2024 16:14:37 +0300 Subject: [PATCH 1/2] chore: created new release workflow --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ package.json | 6 ++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..abe60da --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +# This will trigger the workflow both on a push to main and when a pull request is merged into main. +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + # Run release-it to publish package to npm and create a GitHub release + - name: Publish package and create GitHub release + run: npx release-it --ci + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 313403b..4a0cf40 100644 --- a/package.json +++ b/package.json @@ -110,14 +110,16 @@ "git": { "commitMessage": "chore: release ${version}", "tagName": "v${version}", - "requireCleanWorkingDir": true + "requireCleanWorkingDir": true, + "tagAnnotation": "Release v${version}" }, "npm": { "publish": true, "access": "public" }, "github": { - "release": true + "release": true, + "releaseName": "Release v${version}" }, "plugins": { "@release-it/conventional-changelog": { From d2c1c7b6da2bed331f1b22e4a7f3a2827379c256 Mon Sep 17 00:00:00 2001 From: Herbert Kavuma Date: Wed, 2 Oct 2024 16:50:56 +0300 Subject: [PATCH 2/2] chore: updated release workflow --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 862401b..db6a2d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Build and Test on: push: branches: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index abe60da..deda7cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,22 @@ name: Release -# This will trigger the workflow both on a push to main and when a pull request is merged into main. +# This will trigger the workflow when a pull request is merged into main. on: push: - branches: - - main pull_request: branches: - main + workflow_run: + workflows: ["Build and Test"] # Name of the triggering workflow + types: + - completed # Run this workflow when the 'Build and Test' workflow completes + jobs: release: runs-on: ubuntu-latest - + # Only run if the build and test workflow succeeds + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout uses: actions/checkout@v3