v0.5.0 #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| jobs: | |
| build-linux: | |
| name: Build on Linux (CLI + GUI for Linux/Windows) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| cache: true | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgtk-3-dev \ | |
| libwebkit2gtk-4.1-dev \ | |
| libsoup-3.0-dev \ | |
| libjavascriptcoregtk-4.1-dev \ | |
| build-essential \ | |
| pkg-config | |
| - name: Install Wails | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0 | |
| - name: Create dist directory | |
| run: mkdir -p dist | |
| - name: Build grid-cli (tfcmd) for Linux, Windows, and macOS | |
| working-directory: ./grid-cli | |
| run: | | |
| # Set common ldflags | |
| LDFLAGS="-X github.com/threefoldtech/grid-agent/grid-cli/cmd.commit=${{ github.sha }} \ | |
| -X github.com/threefoldtech/grid-agent/grid-cli/cmd.version=${{ github.ref_name || 'dev' }} \ | |
| -X github.com/threefoldtech/grid-agent/grid-cli/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| # Linux amd64 | |
| echo "Building tfcmd for linux/amd64..." | |
| GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o ../dist/tfcmd-linux-amd64 . | |
| # Windows amd64 | |
| echo "Building tfcmd for windows/amd64..." | |
| GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o ../dist/tfcmd-windows-amd64.exe . | |
| # macOS amd64 | |
| echo "Building tfcmd for darwin/amd64..." | |
| GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o ../dist/tfcmd-darwin-amd64 . | |
| # macOS arm64 | |
| echo "Building tfcmd for darwin/arm64..." | |
| GOOS=darwin GOARCH=arm64 go build -ldflags "$LDFLAGS" -o ../dist/tfcmd-darwin-arm64 . | |
| - name: Build grid-agent-gui for Linux and Windows | |
| working-directory: ./grid-agent-gui | |
| run: | | |
| # Set ldflags for GUI | |
| GUI_LDFLAGS="-X main.Version=${{ github.ref_name || 'dev' }}" | |
| # Linux amd64 | |
| echo "Building grid-agent-gui for linux/amd64..." | |
| wails build -platform linux/amd64 -tags webkit2_41 -ldflags "$GUI_LDFLAGS" -o ../../../dist/grid-agent-gui-linux-amd64 | |
| # Windows amd64 | |
| echo "Building grid-agent-gui for windows/amd64..." | |
| wails build -platform windows/amd64 -tags webkit2_41 -ldflags "$GUI_LDFLAGS" -o ../../../dist/grid-agent-gui-windows-amd64.exe | |
| - name: Upload Linux/Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-linux-windows | |
| path: dist/* | |
| build-macos: | |
| name: Build on macOS (GUI for macOS only) | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| cache: true | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Wails | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0 | |
| - name: Create dist directory | |
| run: mkdir -p dist | |
| - name: Build grid-agent-gui for macOS | |
| working-directory: ./grid-agent-gui | |
| run: | | |
| # Set ldflags for GUI | |
| GUI_LDFLAGS="-X main.Version=${{ github.ref_name || 'dev' }}" | |
| # Ensure expected bin directory exists for Wails | |
| mkdir -p build/bin | |
| # macOS amd64 | |
| echo "Building grid-agent-gui for darwin/amd64..." | |
| wails build -platform darwin/amd64 -tags webkit2_41 -ldflags "$GUI_LDFLAGS" -o ../../../dist/grid-agent-gui-darwin-amd64 | |
| # Archive the .app bundle to avoid uploading internal files individually | |
| (cd build/bin && zip -r ../../../dist/grid-agent-gui-darwin-amd64.app.zip grid-agent-gui.app) | |
| # macOS arm64 | |
| echo "Building grid-agent-gui for darwin/arm64..." | |
| wails build -platform darwin/arm64 -tags webkit2_41 -ldflags "$GUI_LDFLAGS" -o ../../../dist/grid-agent-gui-darwin-arm64 | |
| # Archive the .app bundle for arm64 as well | |
| (cd build/bin && zip -r ../../../dist/grid-agent-gui-darwin-arm64.app.zip grid-agent-gui.app) | |
| - name: Upload macOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-macos | |
| path: dist/* | |
| create-release: | |
| name: Create Release | |
| needs: [build-linux, build-macos] | |
| if: github.event_name == 'release' && github.event.action == 'created' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: 'binaries-*' | |
| merge-multiple: true | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| files: | | |
| dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |