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

Improve github release flow #11

Merged
merged 2 commits into from
Apr 18, 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
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 "wrankles@zerotier.com" && 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
Loading