diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55643e7..47a91d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/README.md b/README.md index d5c2563..de8676f 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/package.json b/package.json index 69ae829..aaed2c2 100644 --- a/package.json +++ b/package.json @@ -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",