ci: update github action. avoid branch protection

This commit is contained in:
travisladuke
2024-02-14 12:53:41 -08:00
committed by Travis LaDuke
parent 2a6871d0e9
commit 047d90a5eb
3 changed files with 21 additions and 18 deletions
+2 -9
View File
@@ -1,11 +1,8 @@
name: npm version && npm publish
name: tag and release
on:
workflow_dispatch:
inputs:
newversion:
description: 'npm version {major,minor,patch}'
required: true
permissions:
contents: write
jobs:
@@ -28,13 +25,9 @@ jobs:
with:
node-version: 18
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- run: git config --global user.email "travis.laduke@zerotier.com"
- run: git config --global user.name "travis laduke"
- run: npm version ${{ github.event.inputs.newversion }}
- run: npm run release
env:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+17 -8
View File
@@ -36,17 +36,26 @@ Releases contain the openapi and json-schema files.
Try to use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages if you want. They will appear in the changelog.
This is a multistep process now due to branch protection.
### Locally, create version:
When main is in a state you'd like to create a new release for:
- create a feature branch off `main`
- `npm version major|minor|patch`
This bumps the version and updates the changelog
- `npm run build`
This is a little chicken and eggy. The build script updates the the spec version based on the npm package version, which just got updated above.
- commit && push
- create PR
- get merged to `main`
### On Github, create release:
- Go into the repo's Github Actions
- Click "npm version && npm publish"
- Click "tag and release"
- Click Run Workflow
- Type "patch", "minor", or "major" and submit
- Run it off `main`
On the CLI you can do:
``` sh
npm version {major,minor,patch}
npm run release
```
The url to the latest release of the openapi spec is: `https://github.com/zerotier/zerotier-one-api-spec/releases/latest/download/openapi.yaml`
+2 -1
View File
@@ -16,7 +16,8 @@
"format-code": "prettier --write **/*.ts",
"lint:openapi": "redocly lint tsp-output/@typespec/openapi3/openapi.yaml",
"lint:code": "eslint .",
"release": "git push --follow-tags && gh-release -y -a=tsp-output/@typespec/openapi3/openapi.yaml,tsp-output/@typespec/json-schema/json-schema.json",
"gh:tag": "git tag -d v${npm_package_version}; git tag v${npm_package_version}",
"release": "npm run gh:tag && git push --tags && gh-release -y -a=tsp-output/@typespec/openapi3/openapi.yaml,tsp-output/@typespec/json-schema/json-schema.json",
"version": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md",
"watch": "run-p watch:*",
"watch:compile": "npm run compile -- --watch",