|
1 | 1 | name: Wails build
|
2 | 2 |
|
3 |
| -on: |
4 |
| - push: |
5 |
| - tags: |
6 |
| - # Match any new tag |
7 |
| - - '*' |
| 3 | +# inspired by https://github.com/dAppServer/wails-build-action/blob/main/action.yml |
| 4 | + |
| 5 | +on: [push] |
8 | 6 |
|
9 | 7 | env:
|
10 | 8 | # Necessary for most environments as build failure can occur due to OOM issues
|
@@ -40,49 +38,47 @@ jobs:
|
40 | 38 | uses: actions/setup-node@v3
|
41 | 39 | with:
|
42 | 40 | node-version: 20
|
43 |
| - # install wails |
| 41 | + |
| 42 | + # install wails and dependencies |
44 | 43 | - name: Install Wails
|
45 |
| - run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.9.0 |
| 44 | + run: | |
| 45 | + WAILS_VERSION=$(cat go.mod | grep "^\s*github.com/wailsapp/wails/" | sed 's/^\s*//' | cut -d" " -f2) |
| 46 | + echo "Use Wails version: ${WAILS_VERSION}" |
| 47 | + go install github.com/wailsapp/wails/v2/cmd/wails@${WAILS_VERSION} |
46 | 48 | shell: bash
|
47 | 49 | - name: Install Linux Wails deps
|
48 | 50 | if: runner.os == 'Linux'
|
49 | 51 | run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu upx-ucl
|
50 | 52 | shell: bash
|
51 |
| - - name: Install macOS Wails deps |
52 |
| - if: runner.os == 'macOS' |
53 |
| - run: brew install mitchellh/gon/gon |
54 |
| - shell: bash |
55 |
| - - name: Check out code into the Go module directory |
| 53 | + |
| 54 | + # Checkout code |
| 55 | + - name: Check out code |
56 | 56 | uses: actions/checkout@v2
|
| 57 | + |
| 58 | + # Build |
57 | 59 | - name: Build
|
58 |
| - id: binary_build |
| 60 | + shell: bash |
59 | 61 | # compression will warn if upx is not installed (windows/macOS) but will not break the build
|
60 | 62 | run: wails build -platform ${{ matrix.build.platform }} -upx -o ${{ matrix.build.name }}
|
61 | 63 |
|
62 |
| - # Add permissions |
63 |
| - - name: Add macOS perms |
64 |
| - if: runner.os == 'macOS' |
65 |
| - run: chmod +x build/bin/*/Contents/MacOS/* |
66 |
| - shell: bash |
67 |
| - - name: Add Linux perms |
68 |
| - if: runner.os == 'Linux' |
69 |
| - run: chmod +x build/bin/* |
70 |
| - shell: bash |
71 |
| - |
72 | 64 | # Package MacOS
|
73 | 65 | - name: Build .app zip file
|
74 | 66 | if: runner.os == 'macOS'
|
75 | 67 | shell: bash
|
76 | 68 | run: |
|
77 |
| - ditto -c -k ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.app.zip |
| 69 | + APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app" |
| 70 | + ditto -c -k ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.app.zip |
78 | 71 | - name: Building Installer
|
79 | 72 | if: runner.os == 'macOS'
|
80 | 73 | shell: bash
|
81 | 74 | run: |
|
82 |
| - productbuild --component ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.pkg |
| 75 | + APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app" |
| 76 | + productbuild --component ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.pkg |
83 | 77 |
|
84 |
| - # Upload build assets |
85 |
| - - uses: actions/upload-artifact@v3 |
| 78 | + # Upload build assets (only for tags) |
| 79 | + - name: Upload build artifacts |
| 80 | + uses: actions/upload-artifact@v3 |
| 81 | + if: startsWith(github.ref, 'refs/tags/') |
86 | 82 | with:
|
87 | 83 | name: Wails Build ${{ matrix.build.name }}
|
88 | 84 | path: |
|
|
0 commit comments