1+ name : Desktop Build
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ tags :
8+ - ' v*'
9+ pull_request :
10+ branches :
11+ - main
12+
13+ permissions :
14+ contents : write
15+
16+ jobs :
17+ build-desktop :
18+ name : Build Desktop Apps
19+ runs-on : ${{ matrix.os }}
20+
21+ strategy :
22+ matrix :
23+ include :
24+ - os : windows-latest
25+ platform : win
26+ artifact : exe
27+ - os : macos-latest
28+ platform : mac
29+ artifact : dmg
30+ - os : ubuntu-latest
31+ platform : linux
32+ artifact : AppImage
33+
34+ steps :
35+ - name : Checkout
36+ uses : actions/checkout@v4
37+
38+ - uses : pnpm/action-setup@v2
39+ with :
40+ version : 9
41+
42+ - name : Setup Node.js
43+ uses : actions/setup-node@v4
44+ with :
45+ node-version : ' 20'
46+ cache : ' pnpm'
47+
48+ - name : Install dependencies
49+ run : pnpm install --frozen-lockfile
50+
51+ - name : Build web app
52+ run : pnpm build
53+
54+ - name : Install desktop dependencies
55+ run : cd apps/desktop && npm install
56+
57+ - name : Build desktop app
58+ run : cd apps/desktop && npm run build:${{ matrix.platform }}
59+
60+ - name : Upload artifacts
61+ uses : actions/upload-artifact@v4
62+ with :
63+ name : typelets-${{ matrix.platform }}
64+ path : |
65+ apps/desktop/dist/*.exe
66+ apps/desktop/dist/*.dmg
67+ apps/desktop/dist/*.AppImage
68+ apps/desktop/dist/*.deb
69+ apps/desktop/dist/*.rpm
70+ retention-days : 90
71+
72+ release :
73+ name : Create Release
74+ needs : build-desktop
75+ runs-on : ubuntu-latest
76+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
77+
78+ steps :
79+ - name : Checkout
80+ uses : actions/checkout@v4
81+ with :
82+ fetch-depth : 2
83+
84+ - name : Check if version changed
85+ id : version-check
86+ run : |
87+ if git diff HEAD~1 HEAD --name-only | grep -E "(package\.json|version)" && git diff HEAD~1 HEAD | grep -E "^\+.*version.*[0-9]+\.[0-9]+\.[0-9]+"; then
88+ VERSION=$(node -p "require('./package.json').version")
89+ echo "version-changed=true" >> $GITHUB_OUTPUT
90+ echo "new-version=v$VERSION" >> $GITHUB_OUTPUT
91+ else
92+ echo "version-changed=false" >> $GITHUB_OUTPUT
93+ fi
94+
95+ - name : Download all artifacts
96+ if : steps.version-check.outputs.version-changed == 'true'
97+ uses : actions/download-artifact@v4
98+ with :
99+ path : release-artifacts
100+
101+ - name : Create Release
102+ if : steps.version-check.outputs.version-changed == 'true'
103+ uses : softprops/action-gh-release@v1
104+ with :
105+ tag_name : ${{ steps.version-check.outputs.new-version }}
106+ name : Release ${{ steps.version-check.outputs.new-version }}
107+ files : |
108+ release-artifacts/typelets-win/*.exe
109+ release-artifacts/typelets-mac/*.dmg
110+ release-artifacts/typelets-linux/*.AppImage
111+ draft : false
112+ prerelease : false
113+ generate_release_notes : true
114+ env :
115+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments