This document covers maintenance tasks that are easy to forget between releases. For regular code changes, run the local checks before opening a pull request:
make lint
make testThe release workflow publishes three outputs when a v* tag is pushed:
- GitHub Release assets, using the repository
GITHUB_TOKEN - Homebrew formula updates, using
TAP_GITHUB_TOKEN - npm package updates, using npm Trusted Publishing with GitHub Actions OIDC
GITHUB_TOKEN is created automatically by GitHub Actions. TAP_GITHUB_TOKEN
must be created manually and saved as a repository secret in go-tapd/cli.
npm publishing does not use a long-lived repository secret; it depends on a
trusted publisher configuration on npmjs.com.
| Secret | Used for | Minimum access |
|---|---|---|
TAP_GITHUB_TOKEN |
Commit the generated Homebrew formula to go-tapd/homebrew-tap |
GitHub fine-grained personal access token with Contents: Read and write on go-tapd/homebrew-tap |
Create this token from GitHub:
- Open
https://github.com/settings/personal-access-tokens. - Click
Generate new token. - Choose
Fine-grained personal access token. - Set a descriptive name, such as
go-tapd-homebrew-release. - Set an expiration date and note it somewhere you will check before the next release.
- Set
Resource ownertogo-tapd. - Set repository access to
Only select repositories. - Select
go-tapd/homebrew-tap. - Under
Repository permissions, setContentstoRead and write. - Leave unrelated permissions as
No access. - Generate the token and copy it immediately.
Save it in the CLI repository:
- Open
https://github.com/go-tapd/cli/settings/secrets/actions. - Click
New repository secret. - Set
NametoTAP_GITHUB_TOKEN. - Paste the token into
Secret. - Save the secret.
Why this permission is needed: GoReleaser writes the generated
Formula/tapd.rb file into go-tapd/homebrew-tap. That operation is a content
write to the tap repository. The token does not need access to issues,
pull requests, actions, administration, or any repository other than
go-tapd/homebrew-tap.
Configure trusted publishing from npm:
- Open
https://www.npmjs.com/package/@go-tapd/tapd. - Open the package settings.
- Find the Trusted Publishing or Trusted Publisher section.
- Choose GitHub Actions as the publisher.
- Set organization or user to
go-tapd. - Set repository to
cli. - Set workflow filename to
release.yml. - Leave environment empty unless the release workflow starts using a GitHub environment.
- Under Allowed actions, select
npm publish. - Click Add publisher to save the trusted publisher configuration.
Why this permission is needed: the release workflow runs npm publish --access public from the npm/ package directory. npm exchanges the GitHub Actions OIDC
identity for a short-lived publish token, so no long-lived npm repository secret
is required. Trusted publishing automatically generates npm provenance
attestations from GitHub Actions, so the workflow does not need to pass
--provenance.
Check that the required GitHub repository secret exists:
gh secret listExpected name:
TAP_GITHUB_TOKEN
Check local npm ownership and package dry-run behavior:
cd npm
npm whoami
npm org ls go-tapd
npm publish --access public --dry-runExpected results:
npm whoamiprints the npm user that owns or can publish undergo-tapd.npm org ls go-tapdlists that user as an owner or member with publish rights.npm publish --access public --dry-runprints the package contents and ends with+ @go-tapd/tapd@....
Manually re-open the npm package settings and confirm the trusted publisher
entry still targets go-tapd/cli, workflow release.yml, and the npm publish
allowed action.
The dry-run does not prove that the trusted publisher is configured correctly. It only proves the local npm account and package metadata are valid. The trusted publisher is exercised by the GitHub Actions release workflow.
When TAP_GITHUB_TOKEN is close to expiration:
- Create a replacement token using the same permissions listed above.
- Update the repository secret in
https://github.com/go-tapd/cli/settings/secrets/actions. - Re-run the verification commands.
- Revoke the old token from GitHub after the new secret is saved.
Do not commit tokens, .npmrc files containing tokens, or screenshots that
show token values.
- GitHub Docs: Managing your personal access tokens
- npm Docs: Creating and viewing access tokens
- npm Docs: Requiring 2FA for package publishing and settings modification
- npm Docs: Generating provenance statements
- npm Docs: Trusted publishing for npm packages