From a6a98f2a5b3e10092d30b687453e31a2c4a6481a Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:34:27 -0600 Subject: [PATCH] fix(configuration): setup semantic versioning for pushes to the master or beta branches --- .github/workflows/build_publish.yml | 14 ++++++++---- .releaserc.json | 34 +++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 .releaserc.json diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index a66dec2..3d45286 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -2,7 +2,11 @@ name: build_publish on: workflow_dispatch: - + push: + paths: + - src/** + branches: + - master jobs: build: runs-on: ubuntu-latest @@ -52,7 +56,6 @@ jobs: with: name: build path: ./dist - publish: needs: build runs-on: ubuntu-latest @@ -66,12 +69,15 @@ jobs: registry-url: https://registry.npmjs.org/ - name: Install dependencies run: npm install - - name: Download a build artifact + - name: Install semantic-release extra plugins + run: npm install --save-dev @semantic-release/changelog @semantic-release/git + - name: Download build artifact uses: actions/download-artifact@v3.0.2 with: name: build path: ./dist - name: Publish to npm registry - run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..14cc2ef --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,34 @@ +{ + "branches": [ + "main", + { + "name": "beta", + "prerelease": true + } + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + "@semantic-release/npm", + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "dist/**", + "package.json", + "README.md", + "License.txt" + ], + "message": "chore(release): set `package.json` to ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] +} diff --git a/package.json b/package.json index 61404cf..7d4fbfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onspring-api-sdk", - "version": "0.0.3", + "version": "0.0.0-semantic-release", "description": "A javascript SDK for interacting with version 2 of the Onspring API.", "keywords": [ "onspring",