v0.1.2 #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: 'Build Native Binaries' | |
| on: | |
| release: | |
| types: [released] | |
| # cancel build action if superseded by new commit on same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| binaries: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [ 'amd64', 'arm64' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set version params | |
| id: version | |
| shell: bash | |
| run: | | |
| echo "git_commit=$(echo ${GITHUB_SHA})" >> $GITHUB_OUTPUT | |
| echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
| echo "git_version=${{github.event.release.tag_name}}" >> $GITHUB_OUTPUT | |
| - name: Print version params | |
| run: | | |
| echo "Commit: ${{ steps.version.outputs.git_commit }}" | |
| echo "Branch: ${{ steps.version.outputs.git_branch }}" | |
| echo "Version: ${{ steps.version.outputs.git_version }}" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build | |
| run: | | |
| GOOS=linux GOARCH=${{ matrix.arch }} go build -o nuts-linux-${{ matrix.arch }} -ldflags="-w -s -X 'github.com/nuts-foundation/nuts-knooppunt/component/status.GitCommit=${GIT_COMMIT}' -X 'github.com/nuts-foundation/nuts-knooppunt/component/status.GitBranch=${GIT_BRANCH}' -X 'github.com/nuts-foundation/nuts-knooppunt/component/status.GitVersion=${GIT_VERSION}'" -o nuts-knooppunt-linux-${{ matrix.arch }} | |
| - name: Upload binary | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload ${{ github.event.release.tag_name }} nuts-knooppunt-linux-${{ matrix.arch }} | |