Skip to content

Commit

Permalink
Add GitHub release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotorres97 committed Dec 20, 2023
1 parent 53dbcd7 commit 5335f0b
Show file tree
Hide file tree
Showing 5 changed files with 2,296 additions and 39 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.release-it.js
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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: infrastructure-production-toolbox-ubuntu22-2g-1cpu-x64
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: 20

- name: Enable yarn
run: corepack enable

- name: Setup SSH Keys and known_hosts
run: |
eval `ssh-agent`
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
mkdir -p ~/.ssh &&
ssh-keyscan github.com >> ~/.ssh/known_hosts
- 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 }}
run: yarn run release --increment "${{ github.event.inputs.VERSION_BUMP }}" -V
22 changes: 22 additions & 0 deletions .release-it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
git: {
changelog: 'echo "## Changelog\n\n$(npx @uphold/github-changelog-generator -f unreleased | tail -n +4 -f)"',
commitMessage: 'Release ${version}',
requireBranch: 'master',
requireCommits: true,
tagName: 'v${version}'
},
github: {
release: true,
releaseName: 'v${version}'
},
hooks: {
'after:bump': [
'echo "$(npx @uphold/github-changelog-generator -f v${version})\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md',
'git add CHANGELOG.md --all'
]
},
npm: {
publish: false
}
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
"test": "test"
},
"scripts": {
"changelog": "uphold-scripts changelog $npm_package_version",
"lint": "uphold-scripts lint",
"release": "uphold-scripts release",
"test": "uphold-scripts test",
"version": "uphold-scripts version"
"release": "release-it",
"test": "uphold-scripts test"
},
"dependencies": {
"json-stringify-safe": "^5.0.1",
Expand All @@ -26,6 +24,8 @@
"traverse": "^0.6.6"
},
"devDependencies": {
"@uphold/github-changelog-generator": "^3.4.0",
"release-it": "^17.0.1",
"uphold-scripts": "^0.9.0"
},
"pre-commit": [
Expand Down
Loading

0 comments on commit 5335f0b

Please sign in to comment.