Skip to content

Commit 10088ef

Browse files
Enhance GitHub Actions workflow for multi-platform builds and releases
1 parent 8643ba1 commit 10088ef

File tree

1 file changed

+53
-6
lines changed

1 file changed

+53
-6
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Build and Release
22

33
on:
44
push:
@@ -8,16 +8,63 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
goos: [linux, windows, darwin]
14+
goarch: [amd64, arm64]
15+
1116
steps:
12-
- uses: actions/checkout@v4
17+
- name: Checkout code
18+
uses: actions/checkout@v4
1319

1420
- name: Set up Go
1521
uses: actions/setup-go@v4
1622
with:
17-
go-version: "1.20"
23+
go-version: "1.23"
1824

1925
- name: Build
20-
run: go build -v ./...
26+
env:
27+
GOOS: ${{ matrix.goos }}
28+
GOARCH: ${{ matrix.goarch }}
29+
run: |
30+
go build -o blast-${{ matrix.goos }}-${{ matrix.goarch }}
31+
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: blast-${{ matrix.goos }}-${{ matrix.goarch }}
36+
path: blast-${{ matrix.goos }}-${{ matrix.goarch }}
37+
38+
release:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
2144

22-
- name: Test
23-
run: go test -v ./...
45+
- name: Download build artifacts
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: blast-${{ matrix.goos }}-${{ matrix.goarch }}
49+
path: ./artifacts
50+
51+
- name: Create GitHub Release
52+
id: create_release
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ github.ref_name }}
58+
release_name: Release ${{ github.ref_name }}
59+
draft: false
60+
prerelease: false
61+
62+
- name: Upload release assets
63+
uses: actions/upload-release-asset@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
66+
with:
67+
upload_url: ${{ steps.create_release.outputs.upload_url }}
68+
asset_path: ./artifacts/blast-*
69+
asset_name: blast-${{ matrix.goos }}-${{ matrix.goarch }}
70+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)