From 9d9afa35bb1eadd09302ddafdc7a28683bfa67c7 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Sat, 25 Oct 2025 22:11:51 +0100 Subject: [PATCH] ci: add publish action for releases (#2181) Defines a GitHub action to publish releases from GitHub CI using the npm trusted publishers method. I've tested this on a smaller project I maintain github.com/jsonresume/jsonresume-theme-class and everything went great, so I'm adopting this in svg/svgo as well. This makes the process of releasing a little less stressful, and significantly reduces the likelihood for human error, like releasing versions under the wrong dist-tag. :sweat: The only difference between this workflow and other ones I've defined is that for SVGO, I use `jq` to check if the version name includes `-rc.` which indicates it's a release candidate. If so, we use the `rc` dist-tag. --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..d1066617 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Node.js Package + +on: + release: + types: [created] + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: corepack enable + - uses: actions/setup-node@v6 + with: + node-version: 22 + registry-url: https://registry.npmjs.org + - run: yarn install + - run: | + if jq -r .version