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 new file mode 100644 index 0000000..deda7cc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +# This will trigger the workflow when a pull request is merged into main. +on: + push: + 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 + + - 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": {