Skip to content

Commit 9913a51

Browse files
committed
chore: github workflow
1 parent 311c696 commit 9913a51

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
name: Create Release & Publish
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
packages: write
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Use Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
registry-url: "https://registry.npmjs.org/"
25+
26+
- name: Configure git
27+
run: |
28+
git config user.name "github-actions[bot]"
29+
git config user.email "github-actions[bot]@users.noreply.github.com"
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Run release (bump version & create changelog)
35+
run: npm run release
36+
37+
- name: Push version bump and changelog
38+
run: |
39+
git push origin main --follow-tags
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Read version from package.json
44+
id: get_version
45+
run: |
46+
VERSION=$(node -p "require('./package.json').version")
47+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
48+
49+
- name: Create GitHub Release
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
tag_name: v${{ steps.get_version.outputs.version }}
53+
name: Release v${{ steps.get_version.outputs.version }}
54+
generate_release_notes: true
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
# - name: Build package
59+
# run: npm run build
60+
61+
# - name: Publish to NPM
62+
# run: npm publish
63+
# env:
64+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)