diff --git a/.github/workflows/binary-build.yml b/.github/workflows/binary-build.yml new file mode 100644 index 0000000..1ba297c --- /dev/null +++ b/.github/workflows/binary-build.yml @@ -0,0 +1,43 @@ +name: Build zurg-testing executable binary + +on: + push: + branches: + - main + tags: + - v0* + - latest +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + goos: [windows, darwin, linux] + goarch: [386, amd64, arm, arm64] # This list can be expanded based on your requirements + exclude: + - goos: darwin + goarch: 386 + - goos: darwin + goarch: arm + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: 'stable' # Adjust according to your Go version + + - name: Build + run: | + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o zurg-${{ matrix.goos }}-${{ matrix.goarch }} cmd/zurg/main.go + upx --brute zurg-${{ matrix.goos }}-${{ matrix.goarch }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: zurg-${{ matrix.goos }}-${{ matrix.goarch }} + path: | + zurg-${{ matrix.goos }}-${{ matrix.goarch }} diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..e792dfc --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,59 @@ +name: Build zurg-testing docker image + +on: + push: + branches: + - main + tags: + - v0* + - latest + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-testing + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache