Skip to content

Commit 4e24b78

Browse files
authored
Merge pull request #1 from BinSquare/codex/add-github-action-for-build-and-release
Add GitHub release workflow for prebuilt binaries
2 parents 0c1d41f + 048d93d commit 4e24b78

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-upload:
9+
name: Build ${{ matrix.artifact_os }} ${{ matrix.artifact_arch }}
10+
runs-on: ${{ matrix.runner }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- goos: linux
16+
goarch: amd64
17+
artifact_os: Linux
18+
artifact_arch: x86_64
19+
runner: ubuntu-latest
20+
- goos: linux
21+
goarch: arm64
22+
artifact_os: Linux
23+
artifact_arch: aarch64
24+
runner: ubuntu-latest
25+
- goos: darwin
26+
goarch: amd64
27+
artifact_os: Darwin
28+
artifact_arch: x86_64
29+
runner: ubuntu-latest
30+
- goos: darwin
31+
goarch: arm64
32+
artifact_os: Darwin
33+
artifact_arch: arm64
34+
runner: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version-file: go.mod
44+
45+
- name: Download dependencies
46+
run: go mod download
47+
48+
- name: Build
49+
env:
50+
CGO_ENABLED: 0
51+
GOOS: ${{ matrix.goos }}
52+
GOARCH: ${{ matrix.goarch }}
53+
run: |
54+
mkdir -p dist
55+
go build -o dist/envmap .
56+
57+
- name: Create archive
58+
run: |
59+
tar -C dist -czf envmap_${{ matrix.artifact_os }}_${{ matrix.artifact_arch }}.tar.gz envmap
60+
61+
- name: Upload release asset
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
files: envmap_${{ matrix.artifact_os }}_${{ matrix.artifact_arch }}.tar.gz
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)