Skip to content

Commit 955517b

Browse files
committed
new release action
1 parent 7260640 commit 955517b

File tree

2 files changed

+18
-56
lines changed

2 files changed

+18
-56
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- 'v*'
67

78
permissions:
89
contents: write
@@ -16,10 +17,6 @@ jobs:
1617
- uses: actions/setup-node@v4
1718
with:
1819
node-version: 22.x
19-
- uses: pnpm/action-setup@v3
20-
with:
21-
version: 8
22-
2320
- name: Get package info
2421
id: package
2522
uses: codex-team/action-nodejs-package-info@v1
@@ -44,35 +41,18 @@ jobs:
4441
- uses: actions/setup-node@v4
4542
with:
4643
node-version: 22.x
47-
- uses: pnpm/action-setup@v3
48-
with:
49-
version: 8
50-
51-
- name: Get pnpm store directory
52-
id: pnpm-cache
53-
shell: bash
54-
run: |
55-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
56-
57-
- uses: actions/cache@v4
58-
name: Setup pnpm cache
59-
with:
60-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
61-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
62-
restore-keys: |
63-
${{ runner.os }}-pnpm-store-
6444

6545
- name: Install dependencies
66-
run: pnpm install
46+
run: npm install
6747

6848
- name: Lint
69-
run: pnpm lint
49+
run: npm run lint
7050

7151
- name: Build
72-
run: pnpm build
52+
run: npm run build
7353

7454
- name: Run tests
75-
run: pnpm test || echo "No tests found, skipping test step"
55+
run: npm test || echo "No tests found, skipping test step"
7656

7757
publish:
7858
runs-on: ubuntu-latest
@@ -87,51 +67,33 @@ jobs:
8767
node-version: 22.x
8868
registry-url: 'https://registry.npmjs.org'
8969

90-
- uses: pnpm/action-setup@v3
91-
with:
92-
version: 8
93-
94-
- name: Get pnpm store directory
95-
id: pnpm-cache
96-
shell: bash
97-
run: |
98-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
99-
100-
- uses: actions/cache@v4
101-
name: Setup pnpm cache
102-
with:
103-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
104-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
105-
restore-keys: |
106-
${{ runner.os }}-pnpm-store-
107-
10870
- name: Install dependencies
109-
run: pnpm install
71+
run: npm install
11072

11173
- name: Build
112-
run: pnpm build
74+
run: npm run build
11375

11476
- name: Generate changelog
11577
id: changelog
11678
uses: metcalfc/[email protected]
11779
with:
11880
myToken: ${{ secrets.GITHUB_TOKEN }}
11981

120-
- name: Update release with changelog
82+
- name: Create GitHub Release
12183
uses: softprops/action-gh-release@v2
12284
env:
12385
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12486
with:
125-
tag_name: ${{ github.event.release.tag_name }}
87+
tag_name: ${{ github.ref_name }}
12688
body: |
12789
${{ steps.changelog.outputs.changelog }}
12890
129-
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.event.release.tag_name }}...HEAD
91+
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.ref_name }}...HEAD
13092
draft: false
13193
prerelease: false
13294

13395
- name: Publish to NPM
134-
run: pnpm publish --no-git-checks
96+
run: npm publish
13597
env:
13698
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
13799

@@ -141,7 +103,7 @@ jobs:
141103
with:
142104
severity: info
143105
details: |
144-
Version ${{ github.event.release.tag_name }} has been successfully published to NPM! 🎉
145-
See the release here: ${{ github.event.release.html_url }}
106+
Version ${{ github.ref_name }} has been successfully published to NPM! 🎉
107+
See the release here: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
146108
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
147109
continue-on-error: true

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
"lint": "eslint",
5353
"lint:fix": "eslint --fix",
5454
"fmt": "eslint --fix",
55-
"release": "npm version patch && git push --follow-tags",
56-
"release:minor": "npm version minor && git push --follow-tags",
57-
"release:major": "npm version major && git push --follow-tags",
55+
"release": "npm version patch --tag-version-prefix=v && git push --follow-tags",
56+
"release:minor": "npm version minor --tag-version-prefix=v && git push --follow-tags",
57+
"release:major": "npm version major --tag-version-prefix=v && git push --follow-tags",
5858
"prepare": "husky"
5959
},
6060
"dependencies": {

0 commit comments

Comments
 (0)