Setup build timeout, improve mobile UI #26
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: Build and Release Agent | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "agent/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: agent/go.mod | |
| cache-dependency-path: agent/go.sum | |
| - name: Build | |
| working-directory: agent | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -ldflags="-s -w" -o agent-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/agent | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: agent/agent-${{ matrix.goos }}-${{ matrix.goarch }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: binaries | |
| merge-multiple: true | |
| - name: Generate SHA256 checksums | |
| run: | | |
| cd binaries | |
| sha256sum agent-* > checksums.txt | |
| - name: Delete existing release assets | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| assets=$(gh api repos/${{ github.repository }}/releases/tags/tip --jq '.assets[].id' 2>/dev/null || echo "") | |
| for asset_id in $assets; do | |
| gh api -X DELETE repos/${{ github.repository }}/releases/assets/$asset_id | |
| done | |
| - name: Upload binaries to Tip release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for binary in binaries/agent-*; do | |
| chmod +x "$binary" | |
| gh release upload tip "$binary" --repo ${{ github.repository }} --clobber | |
| done | |
| gh release upload tip binaries/checksums.txt --repo ${{ github.repository }} --clobber |