1+ name : " publish dweb-app-daved"
2+
3+ on :
4+ workflow_dispatch :
5+ release :
6+ types : [ created ]
7+
8+ # `tauri-action` can also upload app bundles to an existing GitHub release.
9+ # This workflow uses different actions to create and publish the release.
10+ # `tauri-action` will only build and upload the app bundles to the specified release.
11+
12+ jobs :
13+ create-release :
14+ permissions :
15+ contents : write
16+ runs-on : ubuntu-latest
17+ outputs :
18+ release_id : ${{ steps.create-release.outputs.result }}
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : setup node
24+ uses : actions/setup-node@v4
25+ with :
26+ node-version : lts/*
27+
28+ - name : get version
29+ run : echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
30+
31+ - name : create release
32+ id : create-release
33+ uses : actions/github-script@v6
34+ with :
35+ script : |
36+ const { data } = await github.rest.repos.createRelease({
37+ owner: context.repo.owner,
38+ repo: context.repo.repo,
39+ tag_name: `app-v${process.env.PACKAGE_VERSION}`,
40+ name: `Desktop App v${process.env.PACKAGE_VERSION}`,
41+ body: 'Take a look at the assets to download and install this app.',
42+ draft: true,
43+ prerelease: false
44+ })
45+ return data.id
46+
47+ build-tauri :
48+ needs : create-release
49+ permissions :
50+ contents : write
51+ strategy :
52+ fail-fast : false
53+ matrix :
54+ include :
55+ - platform : " macos-latest" # for Arm based macs (M1 and above).
56+ args : " --target aarch64-apple-darwin"
57+ - platform : " macos-latest" # for Intel based macs.
58+ args : " --target x86_64-apple-darwin"
59+ # - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
60+ # args: ""
61+ # - platform: "windows-latest"
62+ # args: ""
63+
64+ runs-on : ${{ matrix.platform }}
65+ steps :
66+ - uses : actions/checkout@v4
67+
68+ - name : setup node
69+ uses : actions/setup-node@v4
70+ with :
71+ node-version : lts/*
72+
73+ - name : install Rust stable
74+ uses : dtolnay/rust-toolchain@stable
75+ with :
76+ # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
77+ targets : ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
78+
79+ - name : install dependencies (ubuntu only)
80+ if : matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
81+ run : |
82+ sudo apt-get update
83+ sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
84+ # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
85+ # You can remove the one that doesn't apply to your app to speed up the workflow a bit.
86+
87+ - name : install frontend dependencies
88+ # change this to yarn, npm, pnpm or bun depending on which one you use.
89+ run :
90+ cd dweb-app
91+ npm add -D @tauri-apps/cli
92+ npm install
93+ . "$HOME/.cargo/env"
94+
95+ - name : Build Tauri app
96+ run :
97+ cd dweb-app
98+ npm run tauri build -- ${{ matrix.args }}
99+ env :
100+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101+
102+ # WAS
103+ # - uses: tauri-apps/tauri-action@v0
104+ # env:
105+ # with:
106+ # releaseId: ${{ needs.create-release.outputs.release_id }}
107+ # args: ${{ matrix.args }}
108+ # projectPath: ./dweb-app
109+
110+ - name : Upload artifacts (macOS)
111+ if : matrix.platform == 'macos-latest'
112+ uses : actions/upload-artifact@v4
113+ with :
114+ name : ${{ matrix.os_name }}-${{ matrix.target }}
115+ path : |
116+ dweb-app/src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
117+
118+ - name : Upload artifacts (Linux)
119+ if : startsWith(matrix.platform, 'ubuntu')
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : ${{ matrix.os_name }}-${{ matrix.target }}
123+ path : |
124+ dweb-app/src-tauri/target/release/bundle/deb/*.deb
125+ dweb-app/src-tauri/target/release/bundle/appimage/*.AppImage
126+
127+ - name : Upload artifacts (Windows)
128+ if : matrix.platform == 'windows-latest'
129+ uses : actions/upload-artifact@v4
130+ with :
131+ name : ${{ matrix.os_name }}-${{ matrix.target }}
132+ path : |
133+ dweb-app/src-tauri/target/release/*.exe
134+
135+ publish-release :
136+ permissions :
137+ contents : write
138+ runs-on : ubuntu-latest
139+ needs : [create-release, build-tauri]
140+
141+ steps :
142+ - name : publish release
143+ id : publish-release
144+ uses : actions/github-script@v6
145+ env :
146+ release_id : ${{ needs.create-release.outputs.release_id }}
147+ with :
148+ script : |
149+ github.rest.repos.updateRelease({
150+ owner: context.repo.owner,
151+ repo: context.repo.repo,
152+ release_id: process.env.release_id,
153+ draft: false,
154+ prerelease: false
155+ })
0 commit comments