Skip to content

Commit a8bacd3

Browse files
authored
Build and publish binaries to GH Releases (#3849) (#3859)
1 parent 9cf2ad8 commit a8bacd3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: 'Build Native Binaries'
3+
4+
on:
5+
release:
6+
types: [released]
7+
8+
# cancel build action if superseded by new commit on same branch
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
binaries:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
arch: [ 'amd64', 'arm64' ]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set version params
24+
id: version
25+
shell: bash
26+
run: |
27+
echo "git_commit=$(echo ${GITHUB_SHA})" >> $GITHUB_OUTPUT
28+
echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
29+
echo "git_version=${{github.event.release.tag_name}}" >> $GITHUB_OUTPUT
30+
31+
- name: Print version params
32+
run: |
33+
echo "Commit: ${{ steps.version.outputs.git_commit }}"
34+
echo "Branch: ${{ steps.version.outputs.git_branch }}"
35+
echo "Version: ${{ steps.version.outputs.git_version }}"
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version-file: 'go.mod'
41+
42+
- name: Build
43+
run: |
44+
GOOS=linux GOARCH=${{ matrix.arch }} go build -o nuts-linux-${{ matrix.arch }} -ldflags="-w -s -X 'github.com/nuts-foundation/nuts-node/core.GitCommit=${GIT_COMMIT}' -X 'github.com/nuts-foundation/nuts-node/core.GitBranch=${GIT_BRANCH}' -X 'github.com/nuts-foundation/nuts-node/core.GitVersion=${GIT_VERSION}'" -o nuts-linux-${{ matrix.arch }}
45+
- name: Upload binary
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
gh release upload ${{ github.event.release.tag_name }} nuts-linux-${{ matrix.arch }}
50+

0 commit comments

Comments
 (0)