Skip to content

Commit 15f20c9

Browse files
authored
ci: setup release job (#2)
1 parent 90911b9 commit 15f20c9

File tree

4 files changed

+1601
-3840
lines changed

4 files changed

+1601
-3840
lines changed

.github/workflows/release.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v5
21+
with:
22+
node-version: '22'
23+
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 10.4.1
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Run build
33+
run: pnpm build
34+
35+
- name: Create tarball
36+
run: |
37+
tar -czf excalidraw.tar.gz dist/
38+
39+
- name: Configure Git
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
44+
- name: Generate changelog and bump version
45+
id: version
46+
run: |
47+
changelogen --bump --output CHANGELOG.md
48+
49+
NEW_VERSION="v$(node -p "require('./package.json').version")"
50+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
51+
52+
- name: Commit changes
53+
run: |
54+
git add package.json CHANGELOG.md
55+
git commit -m "chore(release): ${{ steps.version.outputs.new_version }}"
56+
57+
- name: Create tag
58+
run: git tag ${{ steps.version.outputs.new_version }}
59+
60+
- name: Push changes
61+
run: |
62+
git push origin main
63+
git push origin ${{ steps.version.outputs.new_version }}
64+
65+
- name: Extract changelog for release
66+
id: changelog
67+
run: |
68+
CHANGELOG=$(awk '/^## /{if(++count==2) exit} count==1' CHANGELOG.md | sed '1d')
69+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
70+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
71+
echo "EOF" >> $GITHUB_OUTPUT
72+
73+
- name: Create GitHub Release
74+
uses: softprops/action-gh-release@v2
75+
with:
76+
tag_name: ${{ steps.version.outputs.new_version }}
77+
name: Release ${{ steps.version.outputs.new_version }}
78+
body: ${{ steps.changelog.outputs.changelog }}
79+
draft: false
80+
prerelease: false
81+
files: excalidraw.tar.gz

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
pnpm-lock.yaml

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@types/react-dom": "^19.2.1",
2121
"@vitejs/plugin-react": "^5.0.4",
2222
"@vitejs/plugin-vue-jsx": "^5.1.1",
23+
"changelogen": "^0.6.2",
2324
"eslint": "^9.37.0",
2425
"eslint-plugin-vue": "^10.5.0",
2526
"globals": "^16.4.0",

0 commit comments

Comments
 (0)