Skip to content

Commit

Permalink
build: switch to release-it
Browse files Browse the repository at this point in the history
use wrankles[bot] to create github releases
  • Loading branch information
laduke committed Apr 18, 2024
1 parent ba68ca2 commit 72f5837
Show file tree
Hide file tree
Showing 4 changed files with 3,248 additions and 1,599 deletions.
63 changes: 40 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
name: tag and release
name: Release

on:
workflow_dispatch:
inputs:
newversion:
description: 'npm version {major,minor,patch,premajor,preminor,prepatch,prerelease}'
required: true

permissions:
contents: write
jobs:
version_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# fetch full history so things like auto-changelog work properly
fetch-depth: 0

- name: Install zerotier-one
run: curl -s https://install.zerotier.com/ | sudo bash

- name: Set auth token
run: echo "AUTH_TOKEN=$(sudo cat /var/lib/zerotier-one/authtoken.secret)" >> $GITHUB_ENV

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run release
env:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Generate token'
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: 'Checking out code'
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}

- name: 'Setting up Node'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: 'Install Node Dependencies'
run: npm ci

- name: 'Build'
run: npm run build

- name: 'Test'
run: npm test

- name: 'git config'
run: git config --global user.email "[email protected]" && git config --global user.name "wrankles"

- name: 'Create Release'
run: npm run release -- ${{ github.event.inputs.newversion }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
16 changes: 16 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"npm": {
"publish": false
},
"github": {
"release": true,
"assets": ["tsp-output/@typespec/openapi3/openapi.yaml","tsp-output/@typespec/json-schema/json-schema.json"],
"releaseNotes": "npx auto-changelog -p --stdout -u --template https://raw.githubusercontent.com/release-it/release-it/679bd0e2480d2e04aea4f8d5ecc00183dbd60c05/templates/keepachangelog.hbs --starting-version=${latestTag} --ending-version=${tagName}"
},
"git": {
"changelog": "npx auto-changelog -p --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/679bd0e2480d2e04aea4f8d5ecc00183dbd60c05/templates/keepachangelog.hbs"
},
"hooks": {
"after:bump": ["npm run build", "npx auto-changelog -p"]
}
}
Loading

0 comments on commit 72f5837

Please sign in to comment.