name: Build on: push: tags: - 'v*' workflow_dispatch: permissions: contents: write jobs: build-windows: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.23' - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' - name: Get version id: version shell: bash run: | if [ "${{ github.ref_type }}" = "tag" ]; then echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT else echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT fi - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Build run: | wails build ` -platform windows/amd64 ` -trimpath ` -ldflags "-s -w -X webhelper/global.Version=${{ steps.version.outputs.version }}" ` -o webhelper-windows-amd64.exe - name: Upload artifact uses: actions/upload-artifact@v4 with: name: webhelper-windows-amd64 path: build/bin/webhelper-windows-amd64.exe build-linux: runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.23' - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' - name: Get version id: version run: | if [ "${{ github.ref_type }}" = "tag" ]; then echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT else echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT fi - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y \ libgtk-3-dev \ libwebkit2gtk-4.0-dev \ libayatana-appindicator3-dev \ librsvg2-dev \ patchelf - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Build env: CGO_ENABLED: 1 GOOS: linux GOARCH: amd64 run: | wails build \ -platform linux/amd64 \ -trimpath \ -ldflags "-s -w -X webhelper/global.Version=${{ steps.version.outputs.version }}" \ -o webhelper-linux-amd64 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: webhelper-linux-amd64 path: build/bin/webhelper-linux-amd64 build-linux-new: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.23' - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' - name: Get version id: version run: | if [ "${{ github.ref_type }}" = "tag" ]; then echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT else echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT fi - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y \ libgtk-3-dev \ libwebkit2gtk-4.1-dev \ libayatana-appindicator3-dev \ librsvg2-dev \ patchelf - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Build env: CGO_ENABLED: 1 GOOS: linux GOARCH: amd64 run: | wails build \ -platform linux/amd64 \ -tags webkit2_41 \ -trimpath \ -ldflags "-s -w -X webhelper/global.Version=${{ steps.version.outputs.version }}" \ -o webhelper-linux-amd64-webkit2_41 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: webhelper-linux-amd64-webkit2_41 path: build/bin/webhelper-linux-amd64-webkit2_41 build-macos: runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.23' - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' - name: Get version id: version run: | if [ "${{ github.ref_type }}" = "tag" ]; then echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT else echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT fi - name: Install Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@latest - name: Build amd64 env: CGO_ENABLED: 1 GOOS: darwin GOARCH: amd64 run: | wails build \ -platform darwin/amd64 \ -trimpath \ -ldflags "-s -w -X webhelper/global.Version=${{ steps.version.outputs.version }}" \ -o webhelper-darwin-amd64 - name: Package amd64 run: | cd build/bin hdiutil create -volname "WebHelper" -srcfolder webhelper.app \ -ov -format UDZO -fs HFS+ webhelper-darwin-amd64.dmg - name: Build arm64 env: CGO_ENABLED: 1 GOOS: darwin GOARCH: arm64 run: | wails build \ -platform darwin/arm64 \ -trimpath \ -ldflags "-s -w -X webhelper/global.Version=${{ steps.version.outputs.version }}" \ -o webhelper-darwin-arm64 - name: Package arm64 run: | cd build/bin hdiutil create -volname "WebHelper" -srcfolder webhelper.app \ -ov -format UDZO -fs HFS+ webhelper-darwin-arm64.dmg - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: webhelper-darwin path: | build/bin/webhelper-darwin-amd64.dmg build/bin/webhelper-darwin-arm64.dmg release: needs: [build-windows, build-linux, build-linux-new, build-macos] if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Create release uses: softprops/action-gh-release@v2 with: generate_release_notes: true files: artifacts/*