feat(ci,docs): add release binaries workflow and comprehensive README #5
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 & Publish Docker Image | |
| on: | |
| push: | |
| branches: ["main"] | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout repo | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Enable QEMU for multi-arch | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Enable Buildx for multi-platform builds | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # GHCR login | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Metadata extraction | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| # Build & Push multi-arch images | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| push: true | |
| platforms: | | |
| linux/amd64 | |
| linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:latest | |
| ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| release-binaries: | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25' | |
| - name: Build binaries | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -o spotokn-linux-amd64 ./cmd/spotokn | |
| GOOS=linux GOARCH=arm64 go build -o spotokn-linux-arm64 ./cmd/spotokn | |
| GOOS=darwin GOARCH=amd64 go build -o spotokn-darwin-amd64 ./cmd/spotokn | |
| GOOS=darwin GOARCH=arm64 go build -o spotokn-darwin-arm64 ./cmd/spotokn | |
| GOOS=windows GOARCH=amd64 go build -o spotokn-windows-amd64.exe ./cmd/spotokn | |
| - name: Upload release binaries | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| spotokn-linux-amd64 | |
| spotokn-linux-arm64 | |
| spotokn-darwin-amd64 | |
| spotokn-darwin-arm64 | |
| spotokn-windows-amd64.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |