Release #5
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| - platform: ubuntu-latest | |
| goos: linux | |
| goarch: arm64 | |
| - platform: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| - platform: windows-latest | |
| goos: windows | |
| goarch: arm64 | |
| - platform: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| - platform: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21.x' | |
| cache: false | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Build codes | |
| run: | | |
| go build -o codes ./cmd/codes | |
| - name: Test | |
| run: | | |
| ./codes version | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codes-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: codes | |
| retention-days: 7 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| Cross-platform builds for codes CLI tool | |
| - Linux (amd64, arm64) | |
| - Windows (amd64, arm64) | |
| - macOS (amd64, arm64) |