Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release GitHub workflow #42

Merged
merged 1 commit into from
Sep 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
nodeVersion: [18, 20]
nodeVersion: [18, 20, 22]

name: Tests
runs-on: ubuntu-latest
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
workflow_dispatch:
inputs:
VERSION_BUMP:
description: 'The version bump'
type: choice
options:
- major
- minor
- patch
default: minor
required: true

jobs:
release:
runs-on: ubuntu-latest
concurrency: 1
environment: release

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}

- name: Setup Node.js version
uses: actions/setup-node@v4
with:
node-version: 22

- name: Enable yarn
run: corepack enable

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Configure git
run: |
git config user.name "Uphold"
git config user.email "[email protected]"

- name: Generate release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.RELEASE_NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm run release -- --increment "${{ github.event.inputs.VERSION_BUMP }}" -V
24 changes: 24 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"git": {
"changelog": "echo \"## Changelog\\n\\n$(npx @uphold/github-changelog-generator -f unreleased | tail -n +4 -f)\"",
"requireCleanWorkingDir": false,
"commitMessage": "Release `v${version}`",
"requireBranch": "master",
"requireCommits": true,
"tagName": "v${version}"
},
"github": {
"release": true,
"releaseName": "v${version}"
},
"hooks": {
"after:bump": [
"touch CHANGELOG.md",
"echo \"$(npx @uphold/github-changelog-generator -f v${version})\n$(tail -n +2 CHANGELOG.md)\" > CHANGELOG.md",
"git add CHANGELOG.md --all"
]
},
"npm": {
"publish": true
}
}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ Most javascript loggers should use this format (this one was derived from [bunya

## Release

```shell
❯ npm version [<new version> | major | minor | patch] -m "Release %s"`
```
The release of a version is automated via the [release](https://github.com/uphold/process-manager/actions/workflows/release.yaml) GitHub workflow. Run it by clicking the "Run workflow" button.

## Test

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"main": "src/index.js",
"repository": "https://github.com/uphold/process-manager.git",
"scripts": {
"changelog": "echo \"$(github-changelog-generator --owner=uphold --repo=process-manager --future-release=v$npm_package_version)\n$(tail -n +2 CHANGELOG.md)\" > CHANGELOG.md",
"lint": "eslint src test",
"test": "jest --coverage --verbose",
"version": "npm run changelog && git add -A CHANGELOG.md"
"release": "release-it",
"test": "jest --coverage --verbose"
},
"devDependencies": {
"@uphold/github-changelog-generator": "^3.2.0",
"@uphold/github-changelog-generator": "^3.4.0",
"eslint": "~8.20.0",
"eslint-config-uphold": "^3.2.0",
"jest": "^29.6.4",
"pre-commit": "^1.2.2",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"release-it": "^17.6.0"
},
"jest": {
"restoreMocks": true,
Expand Down
Loading