|
1 | | -name: Build Wails Desktop App |
| 1 | +name: Release Desktop App |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - "v*.*.*" |
7 | 7 | workflow_dispatch: |
8 | 8 |
|
| 9 | +env: |
| 10 | + NODE_OPTIONS: "--max-old-space-size=4096" |
| 11 | + |
9 | 12 | jobs: |
10 | | - build: |
| 13 | + release: |
| 14 | + name: Release Desktop App |
11 | 15 | strategy: |
12 | 16 | matrix: |
13 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
| 17 | + os: [ubuntu-latest, windows-latest, macos-latest] |
14 | 18 |
|
15 | 19 | runs-on: ${{ matrix.os }} |
16 | 20 |
|
17 | 21 | steps: |
18 | 22 | - name: Checkout |
19 | 23 | uses: actions/checkout@v4 |
20 | 24 |
|
| 25 | + - name: Set build name with tag |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + OS_NAME=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') |
| 29 | + if [ "$OS_NAME" = "macos" ]; then OS_NAME="darwin"; fi |
| 30 | + echo "BUILD_NAME=can-finder-${GITHUB_REF_NAME}.${OS_NAME}-amd64" >> $GITHUB_ENV |
| 31 | + version=$(echo ${GITHUB_REF_NAME} | sed -e 's/^v//') |
| 32 | + echo "BUILD_VER=$version" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - name: Echo vars |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + echo "Build name: ${{ env.BUILD_NAME }}" |
| 38 | + echo "Version: ${{ env.BUILD_VER }}" |
| 39 | +
|
21 | 40 | - name: Setup Go |
22 | 41 | uses: actions/setup-go@v5 |
23 | 42 | with: |
24 | | - go-version: '1.24' |
| 43 | + go-version: "1.24.0" |
| 44 | + |
| 45 | + - name: Install Wails CLI |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 49 | + wails doctor |
| 50 | +
|
| 51 | + - name: Update frontend version |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + jq '.info.productVersion = "${{ env.BUILD_VER }}"' wails.json > tmp.json |
| 55 | + mv tmp.json wails.json |
| 56 | + cd frontend |
| 57 | + rm -f package-lock.json |
| 58 | + jq '.version = "${{ env.BUILD_VER }}"' package.json > tmp.json |
| 59 | + mv tmp.json package.json |
25 | 60 |
|
26 | | - - name: Install dependencies (Ubuntu) |
| 61 | + - name: Install Linux prerequisites |
27 | 62 | if: runner.os == 'Linux' |
| 63 | + shell: bash |
28 | 64 | run: | |
29 | 65 | sudo apt-get update |
30 | | - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config |
| 66 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev jq build-essential pkg-config |
31 | 67 |
|
32 | | - - name: Install dependencies (macOS) |
| 68 | + - name: Install macOS prerequisites |
33 | 69 | if: runner.os == 'macOS' |
| 70 | + shell: bash |
34 | 71 | run: | |
35 | | - brew install gtk+3 webkitgtk pkg-config |
| 72 | + brew install gtk+3 webkitgtk jq pkg-config |
36 | 73 |
|
37 | | - - name: Install Wails CLI |
38 | | - run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 74 | + - name: Install Windows prerequisites |
| 75 | + if: runner.os == 'Windows' |
| 76 | + uses: crazy-max/ghaction-chocolatey@v2 |
| 77 | + with: |
| 78 | + args: install nsis jq |
39 | 79 |
|
40 | | - - name: Verify Installation |
41 | | - run: wails doctor |
| 80 | + - name: Build App (Linux) |
| 81 | + if: runner.os == 'Linux' |
| 82 | + shell: bash |
| 83 | + run: | |
| 84 | + wails build -clean -tags webkit2_41 -o ${{ env.BUILD_NAME }} |
42 | 85 |
|
43 | | - - name: Build Application (Linux/MacOS) |
44 | | - if: runner.os != 'Windows' |
| 86 | + - name: Build App (macOS) |
| 87 | + if: runner.os == 'macOS' |
| 88 | + shell: bash |
| 89 | + run: | |
| 90 | + wails build -clean -platform darwin/universal |
| 91 | +
|
| 92 | + - name: Build NSIS Installer (Windows) |
| 93 | + if: runner.os == 'Windows' |
| 94 | + shell: bash |
45 | 95 | run: | |
46 | | - wails build -clean -platform ${{ runner.os == 'Linux' && 'linux/amd64' || 'darwin/universal' }} |
| 96 | + wails build -clean -nsis -webview2 embed |
47 | 97 |
|
48 | | - - name: Build Application (Windows) |
| 98 | + - name: Rename Windows Installer |
49 | 99 | if: runner.os == 'Windows' |
| 100 | + working-directory: ./build/bin |
| 101 | + shell: powershell |
50 | 102 | run: | |
51 | | - wails build -clean -platform windows/amd64 |
| 103 | + Rename-Item -Path "*-installer.exe" -NewName "${{ env.BUILD_NAME }}.exe" |
52 | 104 |
|
53 | | - - name: Upload Release Artifacts |
54 | | - uses: actions/upload-artifact@v4 |
| 105 | + - name: Install nfpm (Linux) |
| 106 | + if: runner.os == 'Linux' |
| 107 | + shell: bash |
| 108 | + run: | |
| 109 | + go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest |
| 110 | +
|
| 111 | + - name: Package with nfpm (Linux) |
| 112 | + if: runner.os == 'Linux' |
| 113 | + shell: bash |
| 114 | + run: | |
| 115 | + NAME=${{ env.BUILD_NAME }} VERSION=${{ env.BUILD_VER }} nfpm pkg --packager deb --config nfpm.yaml -t ${{ env.BUILD_NAME }}.deb |
| 116 | + NAME=${{ env.BUILD_NAME }} VERSION=${{ env.BUILD_VER }} nfpm pkg --packager rpm --config nfpm.yaml -t ${{ env.BUILD_NAME }}.rpm |
| 117 | +
|
| 118 | + - name: Show build artifacts |
| 119 | + shell: bash |
| 120 | + run: | |
| 121 | + ls -alh ./build/bin || true |
| 122 | + ls -alh *.deb *.rpm || true |
| 123 | + ls -alh build/*.app || true |
| 124 | +
|
| 125 | + - name: Archive macOS App |
| 126 | + if: runner.os == 'macOS' |
| 127 | + shell: bash |
| 128 | + run: | |
| 129 | + cd build/bin |
| 130 | + zip -r ../../${{ env.BUILD_NAME }}.zip *.app |
| 131 | +
|
| 132 | + - name: Upload Release Assets (Linux) |
| 133 | + if: runner.os == 'Linux' |
| 134 | + uses: softprops/action-gh-release@v2 |
| 135 | + with: |
| 136 | + files: | |
| 137 | + *.deb |
| 138 | + *.rpm |
| 139 | + env: |
| 140 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 141 | + |
| 142 | + - name: Upload Release Assets (macOS) |
| 143 | + if: runner.os == 'macOS' |
| 144 | + uses: softprops/action-gh-release@v2 |
| 145 | + with: |
| 146 | + files: | |
| 147 | + *.zip |
| 148 | + env: |
| 149 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 150 | + |
| 151 | + - name: Upload Release Assets (Windows) |
| 152 | + if: runner.os == 'Windows' |
| 153 | + uses: softprops/action-gh-release@v2 |
55 | 154 | with: |
56 | | - name: CAN-Finder-${{ matrix.os }} |
57 | | - path: | |
58 | | - build/bin/ |
59 | | - build/*.app |
60 | | - build/*.exe |
| 155 | + files: | |
| 156 | + build/bin/${{ env.BUILD_NAME }}.exe |
| 157 | + env: |
| 158 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments