v2.5.10: add stale install cleanup #3
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: Publish release binaries | |
| on: | |
| push: | |
| tags: ['v*'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-draft: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Build release binaries | |
| env: | |
| CGO_ENABLED: '0' | |
| run: | | |
| mkdir dist | |
| version="${GITHUB_REF_NAME#v}" | |
| ldflags="-s -w -X main.version=$version" | |
| GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_linux_amd64 ./cmd/docfetch | |
| GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_linux_arm64 ./cmd/docfetch | |
| GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_darwin_amd64 ./cmd/docfetch | |
| GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_darwin_arm64 ./cmd/docfetch | |
| GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_windows_amd64.exe ./cmd/docfetch | |
| GOOS=windows GOARCH=arm64 go build -trimpath -ldflags="$ldflags" -o dist/doc-fetch_windows_arm64.exe ./cmd/docfetch | |
| - name: Verify release assets | |
| run: | | |
| test -s dist/doc-fetch_linux_amd64 | |
| test -s dist/doc-fetch_linux_arm64 | |
| test -s dist/doc-fetch_darwin_amd64 | |
| test -s dist/doc-fetch_darwin_arm64 | |
| test -s dist/doc-fetch_windows_amd64.exe | |
| test -s dist/doc-fetch_windows_arm64.exe | |
| - name: Create draft GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create "$GITHUB_REF_NAME" dist/* --draft --verify-tag --generate-notes | |
| verify-macos: | |
| needs: create-draft | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: macos-15-intel | |
| asset: doc-fetch_darwin_amd64 | |
| - runner: macos-15 | |
| asset: doc-fetch_darwin_arm64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Download release binary | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release download "$GITHUB_REF_NAME" --pattern "${{ matrix.asset }}" --dir dist | |
| - name: Verify release binary | |
| run: | | |
| chmod +x "dist/${{ matrix.asset }}" | |
| test "$("dist/${{ matrix.asset }}" --version)" = "doc-fetch version ${GITHUB_REF_NAME#v}" | |
| publish-release: | |
| needs: verify-macos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Publish GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release edit "$GITHUB_REF_NAME" --draft=false |