Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ jobs:
steps:
- name: 🛒 Checkout Code
uses: actions/checkout@v3
- name: Check if package.json Version matches tag
uses: actions/github-script@v6
env:
TAG: ${{ github.ref_name }}
with:
script: |
const fs = require('fs')
const packageJson = JSON.parse(fs.readFileSync('${{ github.workspace }}/package.json'))
const pjv = packageJson.version
const tv = process.env.TAG.replace('v', '')

if (pjv !== tv) {
throw new Error(`The tagged release, ${tv}, doesn't match the package.json version, ${pjv}. Please fix the issue, delete the tag & release and try again.`)
}
- name: 🟢 Use Node.js v18
uses: actions/setup-node@v3
with:
Expand All @@ -27,24 +41,3 @@ jobs:
working-directory: ./dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
sync-repo-version:
name: Sync npm version with source code
runs-on: ubuntu-latest
needs: [ publish ]
steps:
- name: 🛒 Checkout Code
uses: actions/checkout@v3
- name: 📝 Update source code version with npm published version
run: npm run package:increment
env:
TAG: ${{ github.ref_name }}
- name: 💽 Commit changes for version increment
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ":gear: Chore - Update version in package.json & package-lock.json to match release version: ${{ github.ref_name }}"
branch: main
commit_options: '--no-verify'
file_pattern: 'package.json package-lock.json'
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
commit_author: ReleaseBot <github-actions[bot]@users.noreply.github.com>
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,22 @@ In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susa
5. Following any formatting and testing guidelines specific to this repo
6. Push changes to your fork
7. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.

## Releases

All releases are handled via the GitHub release publishing process. Release notes are automatically created based on the
merged pull requests. To cut a release you need to do the following:

1. Check the current release draft for the version (tag)
2. Pull the repo locally, and run `npm version` with the correct version (tag) as determined by the release draft
3. Create a PR titled "Release vX.X.X" and add the label `skip-changelog`
4. Merge the PR and publish the release

### Failed Release due to `npm version`

If you don't properly match the `npm version` with the tag, it will block the release from being published. If you get into this state you need to:

1. Delete the release
2. Delete the tag
3. Manually re-run the "Release Drafter" using `workflow_dispatch`
4. Go through the release process again (and don't screw it up)
Loading