diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6e3e27..93e45ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,8 @@ name: Wails build -on: - push: - tags: - # Match any new tag - - '*' +# inspired by https://github.com/dAppServer/wails-build-action/blob/main/action.yml + +on: [push] env: # Necessary for most environments as build failure can occur due to OOM issues @@ -40,6 +38,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 + # install wails - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.9.0 @@ -48,41 +47,35 @@ jobs: if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu upx-ucl shell: bash - - name: Install macOS Wails deps - if: runner.os == 'macOS' - run: brew install mitchellh/gon/gon - shell: bash - - name: Check out code into the Go module directory + + # Checkout code + - name: Check out code uses: actions/checkout@v2 + + # Build - name: Build - id: binary_build + shell: bash # compression will warn if upx is not installed (windows/macOS) but will not break the build run: wails build -platform ${{ matrix.build.platform }} -upx -o ${{ matrix.build.name }} - # Add permissions - - name: Add macOS perms - if: runner.os == 'macOS' - run: chmod +x build/bin/*/Contents/MacOS/* - shell: bash - - name: Add Linux perms - if: runner.os == 'Linux' - run: chmod +x build/bin/* - shell: bash - # Package MacOS - name: Build .app zip file if: runner.os == 'macOS' shell: bash run: | - ditto -c -k ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.app.zip + APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app" + ditto -c -k ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.app.zip - name: Building Installer if: runner.os == 'macOS' shell: bash run: | - productbuild --component ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.pkg + APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app" + productbuild --component ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.pkg - # Upload build assets - - uses: actions/upload-artifact@v3 + # Upload build assets (only for tags) + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + if: startsWith(github.ref, 'refs/tags/') with: name: Wails Build ${{ matrix.build.name }} path: |