Skip to content

Commit

Permalink
build: add automatic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
thiemok committed Jan 21, 2024
1 parent 685b320 commit b6cd313
Show file tree
Hide file tree
Showing 4 changed files with 2,345 additions and 76 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: release
on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
verify:
name: verify
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install
run: yarn install --immutable
- name: Typecheck
run: yarn check:types
- name: Tests
run: yarn test

release:
name: release
needs: verify
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- name: Generate bot token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Setup git user
uses: gotmax23/[email protected]
with:
global: true
bot: ${{ vars.RELEASE_BOT_ID }}
name: ${{ vars.RELEASE_BOT_NAME }}
- name: Setup
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install
run: yarn install --immutable
- name: Release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
run: yarn release
15 changes: 15 additions & 0 deletions .release-it.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
git:
commitMessage: 'chore(sdk): release v${version} [no ci]'
requireBranch: main
tagName: 'v${version}'
requireCommits: true # Only release if there are any changes to release
github:
release: true
releaseName: 'v${version}'
plugins:
'@release-it/conventional-changelog':
preset:
name: conventionalcommits
infile: 'CHANGELOG.md'
npm:
publish: true
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"devDependencies": {
"@commitlint/config-conventional": "^18.4.4",
"@jest/globals": "^29.7.0",
"@release-it/conventional-changelog": "^8.0.1",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.19.0",
Expand All @@ -20,6 +21,7 @@
"husky": "^8.0.3",
"jest": "^29.7.0",
"lint-staged": "^15.2.0",
"release-it": "^17.0.1",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2",
"vite": "^5.0.12"
Expand All @@ -31,6 +33,7 @@
"check:lint": "eslint",
"check:types": "tsc --noEmit --pretty",
"prepare": "husky install",
"release": "release-it --ci --dry-run",
"generate:yarnSdks": "yarn dlx @yarnpkg/sdks"
},
"jest": {
Expand Down
Loading

0 comments on commit b6cd313

Please sign in to comment.