-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 1.72 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (53 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: 🚀 Auto Release & Publish to NPM
on:
push:
branches:
- main
jobs:
release:
name: Release and Publish
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout Code
uses: actions/checkout@v4
- name: 🟨 Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: 📦 Install Dependencies
run: npm ci
- name: 🛠️ Build Project
run: npm run build
- name: 🔖 Read Version from package.json
id: version
run: |
echo "VERSION=v$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Version: $VERSION"
- name: 🧠 Ensure on main branch
run: |
git checkout main
git pull origin main
- name: 🏷️ Create Git Tag & Push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f $VERSION
git push -f origin $VERSION
- name: 📝 Get full last commit message (with markdown)
id: release_notes
run: |
RELEASE_NOTES="$(git log -1 --pretty=format:%B)"
printf "RELEASE_NOTES<<EOF\n%s\nEOF\n" "$RELEASE_NOTES" >> $GITHUB_ENV
- name: 📢 Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 🚚 Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GIT_TOKEN }}