-
Notifications
You must be signed in to change notification settings - Fork 12
56 lines (53 loc) · 1.57 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Build and Release
env:
go-version: "1.23"
on:
release:
types: [created]
jobs:
release:
strategy:
matrix:
# build and publish in parallel
include:
- image: macos-latest
name: macos-amd64
- image: ubuntu-latest
name: linux-amd64
- image: windows-latest
name: windows-amd64
binaryextension: .exe
- image: [self-hosted, macos, arm64]
name: macos-arm64
- image: ubuntu-latest-arm-8-cores
name: linux-arm64
env:
BINARY_NAME: smcli${{ matrix.binaryextension }}
ARTIFACT_NAME: smcli-${{ github.event.release.tag_name }}-${{ matrix.name }}.tar.gz
runs-on: ${{ matrix.image }}
name: Release ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}
- name: Install required packages
# only run on GH-hosted runner; self-hosted runner already has these
if: ${{ matrix.name == 'linux-amd64' || matrix.name == 'linux-arm64' }}
run: sudo apt-get install -y libudev-dev
- name: Build
run: make build
- name: Prepare files
shell: bash
run: |
mkdir artifacts
mv LICENSE README.md ${{ env.BINARY_NAME }} artifacts
cd artifacts
tar -czf ${{ env.ARTIFACT_NAME }} *
mv ${{ env.ARTIFACT_NAME }} ..
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARTIFACT_NAME }}