feat: add batch download mode subcommand #8
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: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| release_created: ${{ steps.create_release.outputs.release_created }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Calculate Version | |
| id: version | |
| run: | | |
| NEW_VERSION=$(make -s version) | |
| echo "New version: $NEW_VERSION" | |
| echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Create Draft Release | |
| id: create_release | |
| run: | | |
| gh release create "${{ steps.version.outputs.version }}" \ | |
| --title "Release ${{ steps.version.outputs.version }}" \ | |
| --draft \ | |
| --notes "danzo ${{ steps.version.outputs.version }}" \ | |
| --target ${{ github.sha }} | |
| echo "release_created=true" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| binaries: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| - os: linux | |
| arch: arm64 | |
| - os: darwin | |
| arch: amd64 | |
| - os: darwin | |
| arch: arm64 | |
| - os: windows | |
| arch: amd64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| - name: Build Binary | |
| run: make build-for GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} VERSION=${{ needs.create-release.outputs.version }} | |
| - name: Upload Release Asset | |
| run: | | |
| gh release upload "${{ needs.create-release.outputs.version }}" \ | |
| "${{ github.event.repository.name }}-${{ matrix.os }}-${{ matrix.arch }}" \ | |
| --clobber | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| publish: | |
| needs: [create-release, binaries] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish Release | |
| run: gh release edit "${{ needs.create-release.outputs.version }}" --draft=false | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| cleanup-on-failure: | |
| needs: [create-release, binaries, publish] | |
| if: failure() && needs.create-release.outputs.release_created == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Delete Draft Release | |
| run: | | |
| echo "Cleaning up draft release due to workflow failure" | |
| gh release delete "${{ needs.create-release.outputs.version }}" --yes | |
| env: | |
| GH_TOKEN: ${{ github.token }} |