Repository navigation
v0.2.1 #4
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 Release Binaries | |
| on: | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-upload: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| ext: "" | |
| - os: windows-latest | |
| goos: windows | |
| ext: ".exe" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Parse version from release tag | |
| id: meta | |
| shell: bash | |
| run: | | |
| tag="${{ github.event.release.tag_name }}" | |
| version="$(echo "$tag" | sed -E 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/')" | |
| if [[ -z "$version" || "$version" == "$tag" && ! "$tag" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
| echo "Could not parse x.y.z version from tag: $tag" >&2 | |
| exit 1 | |
| fi | |
| filename="trailblazer_${version}_${{ matrix.goos }}_x86_64${{ matrix.ext }}" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "filename=$filename" >> "$GITHUB_OUTPUT" | |
| - name: Build binary | |
| shell: bash | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: amd64 | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -trimpath -ldflags "-s -w" -o "${{ steps.meta.outputs.filename }}" . | |
| - name: Upload binary to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ steps.meta.outputs.filename }} |