From 01069ab3ed6888cdd8a66af586b3118134b79109 Mon Sep 17 00:00:00 2001 From: Christian Flach Date: Sat, 25 Oct 2025 18:10:13 +0200 Subject: [PATCH] ci: Automatically release package through GitHub Actions This deletes the old release script and instead sets up an action to automatically publish the package when a tag is pushed. The changelog and version bump must be created locally using `pnpm run bump-version`, made into a PR, and merged, before manually creating a tag. --- .github/workflows/publish.yml | 32 ++++++++++++++++++++++++++++++++ .versionrc.js | 3 +++ package.json | 2 +- scripts/release.sh | 18 ------------------ 4 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100755 scripts/release.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0399f96 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish Package + +on: + push: + tags: + - "v*" + +permissions: + id-token: write # Required for OIDC + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "24" + cache: "pnpm" + registry-url: "https://registry.npmjs.org" + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + - run: pnpm install --frozen-lockfile + - run: pnpm run lint + - run: pnpm run build + - run: pnpm run test + - run: pnpm -F @cmfcmf/docusaurus-search-local pack + - run: pnpm -F @cmfcmf/docusaurus-search-local publish diff --git a/.versionrc.js b/.versionrc.js index 560af53..477b5d2 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -10,6 +10,9 @@ module.exports = { // Format the generated changelog. postchangelog: "pnpm run format", }, + skip: { + tag: true, + }, header: `\ # Change Log diff --git a/package.json b/package.json index c2f4ce5..cd629a6 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "lint:dependencies": "syncpack list-mismatches", "format:style": "prettier --write .", "format:dependencies": "syncpack fix-mismatches", - "release": "bash scripts/release.sh" + "bump-version": "commit-and-tag-version" }, "lint-staged": { ".": [ diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 3236503..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -pnpm install --frozen-lockfile -pnpm run lint -pnpm run build -pnpm run test -pnpm run test:e2e -- -- --browser=all - -pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlash.js -pnpm run build -w example-docs -- --config docusaurus.config.subDirectory.js -pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlashSubdirectory.js - -pnpm exec commit-and-tag-version "$@" -pnpm -w @cmfcmf/docusaurus-search-local pack -npm login -pnpm -w @cmfcmf/docusaurus-search-local publish -git push --follow-tags origin main