-
-
Notifications
You must be signed in to change notification settings - Fork 120
Harden publish #1227
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
base: main
Are you sure you want to change the base?
Harden publish #1227
Conversation
|
||
runs: | ||
using: composite | ||
steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these steps are required in all of our jobs, this makes it easier to update and reduced code duplication
with: | ||
# This expects you to have a script called release which does a build for your packages and calls changeset publish | ||
publish: pnpm release | ||
publish: pnpm exec changeset tag #only create git tag, publish to registry happens later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit of a trick. Instead of calling changeset publish
we only call changeset tag
.
That leads to the action creating the git tag and github release
It still outputs them as "publishedPackages" but they are tagged only and publish is going to happen in the next job
github.com:443 | ||
release-assets.githubusercontent.com:443 | ||
registry.npmjs.org:443 | ||
*.sigstore.dev:443 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this extra endpoint is required for oidc publish
permissions: | ||
contents: read | ||
id-token: write | ||
environment: release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a github environment that has to be set up in the repo settings. It must have at least a branch restriction to all branches that allow publishing, in vite-plugin-sveltes case that is main
and v5
.
TAG=latest | ||
fi | ||
if [[ "$GIT_STATUS" != "" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure that git state is still clean.This would only fail if an action used by this job or the runner itself was compromised, but better safe than sorry.
e102191
to
fa6eb8c
Compare
release
that prevents this job from executing on other branches