1- name : ' publish'
2-
1+ name : Publish Release
32on :
43 push :
5- branches :
6- - release
4+ tags :
5+ - ' v*'
6+ branches : ' *'
7+ workflow_dispatch :
8+
9+ env :
10+ APP_NAME : " Sample Desktop App"
711
812jobs :
9- publish-tauri :
10- permissions :
11- contents : write
13+ changelog :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+
19+ - name : Build changelog
20+ id : build_changelog
21+ run : |
22+ # NOTE: if commits subjects are standardized, you can filter the git log based on feat: and fix:
23+ # and then replace "feat:" with "New: " and "fix:" with "Fixed "
24+ # when AI gets good, we can also summarized commits into a bullet point list
25+ PREV_TAG=$(git tag --list v* | tail -n2 | head -n1)
26+ echo "changelog=$(git log $PREV_TAG...${{ github.ref_name }} --pretty=format:"- %s")" >> $GITHUB_OUTPUT
27+ outputs :
28+ changelog : ${{ steps.build_changelog.outputs.changelog }}
29+ release :
1230 strategy :
1331 fail-fast : false
1432 matrix :
@@ -17,44 +35,100 @@ jobs:
1735 args : ' --target aarch64-apple-darwin'
1836 - platform : ' macos-latest' # for Intel based macs.
1937 args : ' --target x86_64-apple-darwin'
20- - platform : ' ubuntu-22.04 ' # for Tauri v1 you could replace this with ubuntu-20.04.
38+ - platform : ' ubuntu-latest '
2139 args : ' '
2240 - platform : ' windows-latest'
2341 args : ' '
24-
2542 runs-on : ${{ matrix.platform }}
43+ needs : [changelog]
2644 steps :
27- - uses : actions/checkout@v4
45+ - name : Checkout repository
46+ uses : actions/checkout@v4
47+
48+ # build the changelog based on the commit messages between the versioned tags
49+ - name : Install pnpm
50+ uses : pnpm/action-setup@v4
51+ with :
52+ version : 9
2853
29- - name : setup node
54+ - name : Setup Node.js
3055 uses : actions/setup-node@v4
56+ # NOTE: enterprise developers may hard code a version
3157 with :
32- node-version : lts/*
58+ node-version : ' lts/*'
59+ cache : pnpm
60+ # node-version-file: '.nvmrc'
3361
34- - name : install Rust stable
35- uses : dtolnay/rust-toolchain@stable
62+ - name : Install Rust stable
63+ uses : dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly
3664 with :
3765 # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
3866 targets : ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
3967
40- - name : install dependencies (ubuntu only)
41- if : matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
68+ - name : Rust cache
69+ uses : swatinem/rust-cache@v2
70+ with :
71+ workspaces : ' ./src-tauri -> target'
72+
73+ - name : Install Ubuntu dependencies
74+ if : matrix.platform == 'ubuntu-latest'
4275 run : |
43- sudo apt-get update
44- sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
45- # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
46- # You can remove the one that doesn't apply to your app to speed up the workflow a bit.
76+ sudo apt update
77+ xargs sudo apt install -y < environment/apt_packages.txt
4778
48- - name : install frontend dependencies
49- run : yarn install # change this to npm, pnpm or bun depending on which one you use.
79+ - name : Install frontend dependencies
80+ run : |
81+ pnpm install
82+
83+ - name : CI Build
84+ if : ${{ github.ref_type == 'branch' }}
85+ run : |
86+ pnpm rls
87+
88+ - name : CI upload Windows
89+ if : ${{ github.ref_type == 'branch' && matrix.platform == 'windows-latest' }}
90+ uses : actions/upload-artifact@v4
91+ with :
92+ name : ' Windows Installers'
93+ path : |
94+ src-tauri/release/bundle/msi/*.msi
95+ src-tauri/release/bundle/nsis/*.exe
96+
97+ - name : CI upload macOS
98+ if : ${{ github.ref_type == 'branch' && matrix.platform == 'macos-latest' }}
99+ uses : actions/upload-artifact@v4
100+ with :
101+ name : ' macOS Installer'
102+ path : |
103+ src-tauri/release/bundle/dmg/*.dmg
104+
105+ - name : CI upload Linux
106+ if : ${{ github.ref_type == 'branch' && matrix.platform == 'ubuntu-latest' }}
107+ uses : actions/upload-artifact@v4
108+ with :
109+ name : ' Linux Distributions'
110+ path : |
111+ src-tauri/target/release/bundle/deb/*.deb
112+ src-tauri/target/release/bundle/AppImage/*.AppImage
50113
51- - uses : tauri-apps/tauri-action@v0
114+ # TODO: https://tauri.app/v1/guides/building/linux#cross-compiling-tauri-applications-for-arm-based-devices
115+ - name : Build Tauri app
116+ uses : tauri-apps/tauri-action@v0
117+ if : ${{ github.ref_type == 'tag' }}
118+ # if u get Error: Resource not accessible by integration
119+ # go to repository Settings => Action => General => Workflow permissions => Switch to Read and Write permisions
52120 env :
121+ CI : true
53122 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
123+ TAURI_SIGNING_PRIVATE_KEY : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
124+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
54125 with :
55- tagName : app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
56- releaseName : ' App v__VERSION__'
57- releaseBody : ' See the assets to download this version and install.'
126+ # tauri-action replaces \_\_VERSION\_\_ with the app version
127+ tagName : ${{ github.ref_name }}
128+ releaseName : " ${{ env.APP_NAME }} v__VERSION__"
129+ releaseBody : |
130+ ${{needs.changelog.outputs.changelog}}
131+ See the assets to download this version and install.
58132 releaseDraft : true
59133 prerelease : false
60- args : ${{ matrix.args }}
134+ args : ${{ matrix.args }}
0 commit comments