Skip to content

Commit 02aa141

Browse files
authored
Codex/fix release action test (#30)
* fix(ci): resolve pnpm version conflict in release workflow * ci: add manual workflow to publish npm test prerelease * ci(release): support manual npm test-tag publish via workflow_dispatch * fix(ci): correct test prerelease version generation * refactor(ci): remove redundant publish-test workflow
1 parent 95f2a69 commit 02aa141

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
paths-ignore:
88
- Formula/ais.rb
99
workflow_dispatch:
10+
inputs:
11+
publish_test:
12+
description: Publish a prerelease package to npm "test" tag
13+
required: false
14+
default: true
15+
type: boolean
1016

1117
permissions:
1218
contents: write
@@ -24,8 +30,6 @@ jobs:
2430

2531
- name: Setup pnpm
2632
uses: pnpm/action-setup@v4
27-
with:
28-
version: 9.15.3
2933

3034
- name: Setup Node.js
3135
uses: actions/setup-node@v4
@@ -43,8 +47,23 @@ jobs:
4347
- name: Build
4448
run: pnpm build
4549

50+
- name: Set unique prerelease version for test publish
51+
id: test_version
52+
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
53+
run: |
54+
VERSION=$(node -e 'const fs=require("fs");const pkg=JSON.parse(fs.readFileSync("package.json","utf8"));const [major,minor,patch]=pkg.version.split("-")[0].split(".").map(Number);console.log([major,minor,patch+1].join(".")+"-test."+process.env.GITHUB_RUN_NUMBER+"."+process.env.GITHUB_RUN_ATTEMPT);')
55+
npm version "$VERSION" --no-git-tag-version
56+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
57+
58+
- name: Publish npm test tag
59+
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
60+
run: pnpm publish --tag test --no-git-checks
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
4664
- name: Create release PR or publish
4765
id: changesets
66+
if: github.event_name != 'workflow_dispatch' || inputs.publish_test != true
4867
uses: changesets/action@v1
4968
with:
5069
version: pnpm changeset version
@@ -63,6 +82,10 @@ jobs:
6382
VERSION=$(node -p "require('./package.json').version")
6483
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
6584
85+
- name: Summary for test publish
86+
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
87+
run: echo "Published ai-rules-sync@${{ steps.test_version.outputs.version }} to npm tag 'test'."
88+
6689
update-homebrew:
6790
needs: release
6891
if: needs.release.outputs.published == 'true'

0 commit comments

Comments
 (0)