|
1 | | -name: Release |
| 1 | +name: "Build release" |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | | - tags: |
5 | | - - 'v*' |
| 5 | + branches: |
| 6 | + - release |
6 | 7 | workflow_dispatch: |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - release: |
| 10 | + build-tauri-and-release: |
10 | 11 | strategy: |
11 | | - fail-fast: false |
| 12 | + fail-fast: true |
12 | 13 | matrix: |
13 | 14 | platform: [windows-latest] |
| 15 | + |
14 | 16 | runs-on: ${{ matrix.platform }} |
15 | 17 | steps: |
16 | | - - name: Checkout repository |
17 | | - uses: actions/checkout@v3 |
| 18 | + - uses: actions/checkout@v3 |
18 | 19 |
|
19 | | - - name: Install dependencies (ubuntu only) |
20 | | - if: matrix.platform == 'ubuntu-20.04' |
21 | | - # You can remove libayatana-appindicator3-dev if you don't use the system tray feature. |
22 | | - run: | |
23 | | - sudo apt-get update |
24 | | - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev |
| 20 | + - name: ⚡ Set short SHA ENV |
| 21 | + run: echo "SHORT_SHA=$("${{ github.sha }}".SubString(0, 8))" >> $env:GITHUB_ENV |
25 | 22 |
|
26 | | - - name: Rust setup |
| 23 | + - name: ⏬ Install Rust stable |
27 | 24 | uses: dtolnay/rust-toolchain@stable |
| 25 | + with: |
| 26 | + profile: minimal |
| 27 | + toolchain: stable |
28 | 28 |
|
29 | | - - name: Rust cache |
30 | | - uses: swatinem/rust-cache@v2 |
| 29 | + - name: ⚡ Set up cargo cache |
| 30 | + uses: actions/cache@v3 |
| 31 | + continue-on-error: false |
31 | 32 | with: |
32 | | - workspaces: './src-tauri -> target' |
| 33 | + path: | |
| 34 | + ~/.cargo/bin/ |
| 35 | + ~/.cargo/registry/index/ |
| 36 | + ~/.cargo/registry/cache/ |
| 37 | + ~/.cargo/git/db/ |
| 38 | + src-tauri/target/ |
| 39 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 40 | + restore-keys: ${{ runner.os }}-cargo |
33 | 41 |
|
34 | | - - name: Sync node version and setup cache |
| 42 | + - name: 🔄 Sync node version |
35 | 43 | uses: actions/setup-node@v3 |
36 | 44 | with: |
37 | | - node-version: 'lts/*' |
38 | | - cache: 'yarn' # Set this to npm, yarn or pnpm. |
| 45 | + node-version: "lts/*" |
| 46 | + cache: "yarn" |
39 | 47 |
|
40 | | - - name: Install app dependencies and build web |
41 | | - # Remove `&& yarn build` if you build your frontend in `beforeBuildCommand` |
42 | | - run: yarn && yarn build # Change this to npm, yarn or pnpm. |
| 48 | + - name: ⏬ Install Ubuntu dependencies |
| 49 | + if: matrix.platform == 'ubuntu-20.04' |
| 50 | + run: | |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf |
43 | 53 |
|
44 | | - - name: Build the app |
45 | | - uses: tauri-apps/tauri-action@v0 |
| 54 | + - name: 📥 Install Node Dependencies |
| 55 | + run: yarn && yarn build |
46 | 56 |
|
| 57 | + - name: 🔨 Build |
| 58 | + uses: tauri-apps/tauri-action@v0 |
| 59 | + id: tauri-build |
47 | 60 | env: |
48 | 61 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
49 | 62 | with: |
50 | | - tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags. |
51 | | - releaseName: 'App Name v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version. |
52 | | - releaseBody: 'See the assets to download and install this version.' |
| 63 | + tagName: soundcoremanager-v__VERSION__ |
| 64 | + releaseName: 'Soundcore Manager v__VERSION__' |
| 65 | + releaseBody: 'See the assets to download this version and install.' |
53 | 66 | releaseDraft: true |
54 | 67 | prerelease: false |
| 68 | + |
| 69 | + - name: ⏫ Upload Release Asset |
| 70 | + id: upload-release-asset |
| 71 | + uses: actions/upload-release-asset@v1.0.2 |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + with: |
| 75 | + upload_url: ${{ steps.tauri-build.outputs.releaseUploadUrl }} |
| 76 | + asset_path: src-tauri\target\release\deps\soundcoremanager.exe |
| 77 | + asset_name: SoundcoreManager-${{ matrix.platform }}-${{ env.SHORT_SHA }}.exe |
| 78 | + asset_content_type: application/vnd.microsoft.portable-executable. |
| 79 | + |
| 80 | + - name: Rename soundcoremanager.exe |
| 81 | + if: matrix.platform == 'windows-latest' |
| 82 | + run: ren src-tauri\target\release\deps\soundcoremanager.exe SoundcoreManager-${{ matrix.platform }}-${{ env.SHORT_SHA }}.exe |
| 83 | + |
| 84 | + - name: ⏫ Upload Build Artifact |
| 85 | + if: matrix.platform == 'windows-latest' |
| 86 | + uses: actions/upload-artifact@v3 |
| 87 | + with: |
| 88 | + name: SoundcoreManager-${{ matrix.platform }}.exe |
| 89 | + path: src-tauri\target\release\deps\SoundcoreManager-${{ matrix.platform }}-${{ env.SHORT_SHA }}.exe |
| 90 | + |
| 91 | + |
0 commit comments