Skip to content

Commit 2d433e6

Browse files
author
Wei
authored
Merge pull request #2 from IRONICBo/ci/add-artifact-ci
ci: add artifact build ci.
2 parents 415e1c0 + ea0cea5 commit 2d433e6

3 files changed

Lines changed: 98 additions & 0 deletions

File tree

.github/pull-request-template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Fixes #
2+
3+
<!-- Please include the 'why' behind your changes if no issue exists -->
4+
## Proposed Changes
5+
6+
*
7+
*
8+
*
9+
10+
**Release Note**
11+
12+
<!-- Enter your extended release note in the below block. If the PR requires
13+
additional action from users switching to the new release, include the string
14+
"action required". If no release note is required, write "NONE". -->
15+
16+
```release-note
17+
18+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Go Binaries
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: Build binaries for multiple platforms
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
goos: [linux, windows, darwin]
17+
goarch: [amd64, arm64]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.23'
27+
28+
- name: Build binary
29+
env:
30+
GOOS: ${{ matrix.goos }}
31+
GOARCH: ${{ matrix.goarch }}
32+
run: |
33+
mkdir -p dist/${GOOS}_${GOARCH}
34+
go build -o dist/${GOOS}_${GOARCH}/migrate
35+
36+
- name: Upload artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: migrate-${{ matrix.goos }}-${{ matrix.goarch }}
40+
path: dist/
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release Go Binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
name: Build and Release
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
goos: [linux, windows, darwin]
16+
goarch: [amd64, arm64]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.23'
26+
27+
- name: Build binary
28+
env:
29+
GOOS: ${{ matrix.goos }}
30+
GOARCH: ${{ matrix.goarch }}
31+
run: |
32+
mkdir -p dist
33+
binary_name=migrate-${{ matrix.goos }}-${{ matrix.goarch }}
34+
go build -o dist/${binary_name}
35+
36+
- name: Upload release assets
37+
uses: softprops/action-gh-release@v1
38+
with:
39+
tag_name: ${{ github.ref_name }}
40+
files: dist/*

0 commit comments

Comments
 (0)