|
| 1 | +name: Wails Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + branches: [ "main" ] |
| 10 | + |
| 11 | +env: |
| 12 | + # Necessary for Wails to find the correct binary path |
| 13 | + WAILS_VERSION: latest |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + name: Build for ${{ matrix.os }} |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup Go |
| 28 | + uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version: '1.21' |
| 31 | + check-latest: true |
| 32 | + |
| 33 | + - name: Setup Node |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: '18' |
| 37 | + |
| 38 | + # Linux specific dependencies |
| 39 | + - name: Install Linux Dependencies |
| 40 | + if: matrix.os == 'ubuntu-latest' |
| 41 | + run: | |
| 42 | + sudo apt-get update |
| 43 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev |
| 44 | +
|
| 45 | + - name: Install Wails |
| 46 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 47 | + |
| 48 | + - name: Build Application |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + cd shuyuy |
| 52 | + export PATH=$PATH:$(go env GOPATH)/bin |
| 53 | + wails build |
| 54 | +
|
| 55 | + # Rename binary for upload (Linux) |
| 56 | + - name: Rename Binary (Linux) |
| 57 | + if: matrix.os == 'ubuntu-latest' |
| 58 | + run: mv shuyuy/build/bin/shuyuy shuyuy/build/bin/shuyuy-linux-amd64 |
| 59 | + |
| 60 | + # Rename binary for upload (Windows) |
| 61 | + - name: Rename Binary (Windows) |
| 62 | + if: matrix.os == 'windows-latest' |
| 63 | + run: mv shuyuy/build/bin/shuyuy.exe shuyuy/build/bin/shuyuy-windows-amd64.exe |
| 64 | + |
| 65 | + # Rename binary for upload (macOS) |
| 66 | + # Wails builds a .app bundle on macOS. We zip it. |
| 67 | + - name: Package macOS App |
| 68 | + if: matrix.os == 'macos-latest' |
| 69 | + run: | |
| 70 | + cd shuyuy/build/bin |
| 71 | + zip -r ../../shuyuy-macos-universal.zip shuyuy.app |
| 72 | +
|
| 73 | + - name: Upload Artifacts |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: shuyuy-${{ matrix.os }} |
| 77 | + path: | |
| 78 | + shuyuy/build/bin/shuyuy-linux-amd64 |
| 79 | + shuyuy/build/bin/shuyuy-windows-amd64.exe |
| 80 | + shuyuy/shuyuy-macos-universal.zip |
| 81 | +
|
| 82 | + release: |
| 83 | + needs: build |
| 84 | + if: startsWith(github.ref, 'refs/tags/v') |
| 85 | + runs-on: ubuntu-latest |
| 86 | + permissions: |
| 87 | + contents: write |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Download Artifacts |
| 92 | + uses: actions/download-artifact@v4 |
| 93 | + with: |
| 94 | + path: artifacts |
| 95 | + |
| 96 | + - name: Create Release |
| 97 | + uses: softprops/action-gh-release@v1 |
| 98 | + with: |
| 99 | + files: | |
| 100 | + artifacts/shuyuy-ubuntu-latest/shuyuy-linux-amd64 |
| 101 | + artifacts/shuyuy-windows-latest/shuyuy-windows-amd64.exe |
| 102 | + artifacts/shuyuy-macos-latest/shuyuy-macos-universal.zip |
| 103 | + generate_release_notes: true |
0 commit comments