name: Release on: push: tags: - "v*" permissions: contents: read packages: write jobs: docker: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Resolve tag metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=raw,value=latest - uses: docker/build-push-action@v6 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} binaries: runs-on: ubuntu-latest permissions: contents: write strategy: matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 - goos: windows goarch: amd64 steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version: "1.26" cache: true - name: Build env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: "0" run: | bin=ghstats [ "$GOOS" = windows ] && bin=ghstats.exe mkdir -p dist go build -trimpath -ldflags="-s -w" -o "dist/$bin" . cd dist if [ "$GOOS" = windows ]; then zip "ghstats_${GOOS}_${GOARCH}.zip" "$bin" else tar -czf "ghstats_${GOOS}_${GOARCH}.tar.gz" "$bin" fi - uses: softprops/action-gh-release@v2 with: files: dist/ghstats_*.*