Skip to content

Commit

Permalink
ci: update github action. avoid branch protection
Browse files Browse the repository at this point in the history
  • Loading branch information
laduke committed Feb 14, 2024
1 parent 2a6871d commit 047d90a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 "[email protected]"
- 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 }}
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:/zerotier/zerotier-one-api-spec/releases/latest/download/openapi.yaml`

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 047d90a

Please sign in to comment.