v3.0.3 #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: Release | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }}-${{ matrix.arch }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| ext: "" | |
| - os: linux | |
| arch: arm64 | |
| ext: "" | |
| - os: darwin | |
| arch: amd64 | |
| ext: "" | |
| - os: darwin | |
| arch: arm64 | |
| ext: "" | |
| - os: windows | |
| arch: amd64 | |
| ext: ".exe" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Get version | |
| id: version | |
| run: | | |
| # Use git tag for filenames (e.g., v3.0.0) | |
| TAG="${GITHUB_REF_NAME}" | |
| # Strip 'v' prefix for version number in binary | |
| VERSION="${TAG#v}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| # Build with version injected | |
| go build -ldflags="-s -w -X main.Version=${{ steps.version.outputs.version }}" \ | |
| -o hfdownloader_${{ matrix.os }}_${{ matrix.arch }}_${{ steps.version.outputs.tag }}${{ matrix.ext }} \ | |
| ./cmd/hfdownloader | |
| - name: Upload raw binary | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: hfdownloader_${{ matrix.os }}_${{ matrix.arch }}_${{ steps.version.outputs.tag }}${{ matrix.ext }} | |
| checksums: | |
| name: Generate checksums | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| mkdir -p release-files | |
| gh release download ${{ github.ref_name }} -D release-files -R ${{ github.repository }} | |
| - name: Generate checksums | |
| run: | | |
| cd release-files | |
| sha256sum * > checksums.txt | |
| cat checksums.txt | |
| - name: Upload checksums | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release-files/checksums.txt |