Skip to content

Conversation

dominikg
Copy link
Member

  • introduce step-security hardened runner action
  • introduce composite action to reduce repeated steps
  • move call to publish into a separate job with
    • an assigned environment release that prevents this job from executing on other branches
    • minimal permissions
    • no pnpm install


runs:
using: composite
steps:
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant