From 631188df8587027ea3f21630e160d9d60e04e5f1 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 26 Nov 2025 01:08:30 +0800 Subject: [PATCH] ci: migrate release publish to github actions --- .../{docs-deploy.yml => docs-deploy.yaml} | 15 ++++-- ...y.yml => example-layout-slots-deploy.yaml} | 6 +-- .github/workflows/{lint.yml => lint.yaml} | 7 +-- .github/workflows/release.yaml | 54 +++++++++++++++++++ .github/workflows/release.yml | 22 -------- .github/workflows/{test.yml => test.yaml} | 9 ++-- cli/package.json | 4 ++ package.json | 5 +- plugins/plugin-fonts/package.json | 3 +- plugins/plugin-md-power/package.json | 3 +- plugins/plugin-search/package.json | 3 +- theme/package.json | 7 ++- 12 files changed, 95 insertions(+), 43 deletions(-) rename .github/workflows/{docs-deploy.yml => docs-deploy.yaml} (76%) rename .github/workflows/{example-layout-slots-deploy.yml => example-layout-slots-deploy.yaml} (89%) rename .github/workflows/{lint.yml => lint.yaml} (80%) create mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/release.yml rename .github/workflows/{test.yml => test.yaml} (79%) diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yaml similarity index 76% rename from .github/workflows/docs-deploy.yml rename to .github/workflows/docs-deploy.yaml index a15b94c7..a632f2f9 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yaml @@ -2,15 +2,20 @@ name: Deploy Docs on: push: - tags: - - v* + branches: + - main + paths: + - docs/** + - CONTRIBUTING.md + - CONTRIBUTING.en-US.md workflow_dispatch: + workflow_call: jobs: deploy-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -18,9 +23,9 @@ jobs: uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 cache: pnpm - name: Install deps diff --git a/.github/workflows/example-layout-slots-deploy.yml b/.github/workflows/example-layout-slots-deploy.yaml similarity index 89% rename from .github/workflows/example-layout-slots-deploy.yml rename to .github/workflows/example-layout-slots-deploy.yaml index 5a0429be..e0a877c5 100644 --- a/.github/workflows/example-layout-slots-deploy.yml +++ b/.github/workflows/example-layout-slots-deploy.yaml @@ -10,7 +10,7 @@ jobs: deploy-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -18,9 +18,9 @@ jobs: uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 cache: pnpm - name: Install deps diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yaml similarity index 80% rename from .github/workflows/lint.yml rename to .github/workflows/lint.yaml index 5b881710..98062875 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yaml @@ -6,6 +6,7 @@ on: pull_request: branches: [main] + workflow_call: jobs: lint: @@ -13,15 +14,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 cache: pnpm - name: Install deps diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..04581fb1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,54 @@ +name: Add Release Tag + +on: + push: + tags: + - v* + +jobs: + lint: + uses: ./.github/workflows/lint.yaml + + test: + uses: ./.github/workflows/test.yaml + + release: + if: github.repository == 'pengzhanbo/vuepress-theme-plume' + needs: [test, lint] + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v6 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + cache: pnpm + + - name: Install deps + run: pnpm install + + - name: Update npm + run: npm i -g npm@latest + + - name: Build And Publish + id: publish + run: | + pnpm build + pnpm release:publish --no-git-checks + pnpm release:sync + + - run: npx changelogithub + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + deploy: + uses: ./.github/workflows/docs-deploy.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b082d338..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Add Release Tag - -on: - push: - tags: - - v* - -jobs: - changelog: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - run: npx changelogithub - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yaml similarity index 79% rename from .github/workflows/test.yml rename to .github/workflows/test.yaml index 95b24341..451ef063 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yaml @@ -6,6 +6,7 @@ on: pull_request: branches: [main] + workflow_call: jobs: unit-test: @@ -13,15 +14,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 cache: pnpm - name: Install deps @@ -34,6 +35,6 @@ jobs: - name: Upload coverage if: github.ref == 'refs/heads/main' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/cli/package.json b/cli/package.json index e3761315..3828941b 100644 --- a/cli/package.json +++ b/cli/package.json @@ -44,5 +44,9 @@ "vue": "^3.5.22", "http-server": "^14.1.1", "typescript": "^5.9.3" + }, + "publishConfig": { + "access": "public", + "provenance": true } } diff --git a/package.json b/package.json index 3233853c..f72ada4b 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,12 @@ "lint:css": "stylelint **/*.{css,vue}", "test": "cross-env TZ=Etc/UTC vitest --coverage", "prepare": "husky", - "release": "pnpm release:check && pnpm release:version && pnpm -r publish && pnpm release:sync", "release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "release:check": "pnpm lint && pnpm build", "release:sync": "node scripts/mirror-sync.mjs", - "release:version": "bumpp package.json plugins/*/package.json theme/package.json cli/package.json --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all --tag --push" + "release:publish": "pnpm -r publish --tag latest", + "release:version": "bumpp package.json plugins/*/package.json theme/package.json cli/package.json --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all --tag --push", + "release": "pnpm release:check && pnpm release:version" }, "devDependencies": { "@commitlint/cli": "catalog:dev", diff --git a/plugins/plugin-fonts/package.json b/plugins/plugin-fonts/package.json index dd802b95..cc74d777 100644 --- a/plugins/plugin-fonts/package.json +++ b/plugins/plugin-fonts/package.json @@ -36,7 +36,8 @@ "vuepress": "catalog:vuepress" }, "publishConfig": { - "access": "public" + "access": "public", + "provenance": true }, "keyword": [ "VuePress", diff --git a/plugins/plugin-md-power/package.json b/plugins/plugin-md-power/package.json index 20dcc7e1..33281f7b 100644 --- a/plugins/plugin-md-power/package.json +++ b/plugins/plugin-md-power/package.json @@ -115,7 +115,8 @@ "mpegts.js": "catalog:peer" }, "publishConfig": { - "access": "public" + "access": "public", + "provenance": true }, "keyword": [ "VuePress", diff --git a/plugins/plugin-search/package.json b/plugins/plugin-search/package.json index 517c5f6c..841fc172 100644 --- a/plugins/plugin-search/package.json +++ b/plugins/plugin-search/package.json @@ -51,7 +51,8 @@ "vue": "catalog:prod" }, "publishConfig": { - "access": "public" + "access": "public", + "provenance": true }, "keyword": [ "VuePress", diff --git a/theme/package.json b/theme/package.json index 875d43fa..5a55aa30 100644 --- a/theme/package.json +++ b/theme/package.json @@ -8,7 +8,8 @@ "homepage": "https://theme-plume.vuejs.press/", "repository": { "type": "git", - "url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git" + "url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git", + "directory": "theme" }, "bugs": { "url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues" @@ -151,5 +152,9 @@ "swiper": "catalog:peer", "three": "catalog:peer", "vue-router": "catalog:dev" + }, + "publishConfig": { + "access": "public", + "provenance": true } }