-
Notifications
You must be signed in to change notification settings - Fork 6
90 lines (76 loc) · 1.97 KB
/
ci.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: CI/CD
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install Task
run: go install github.com/go-task/task/v3/cmd/task@latest
- name: Run tests
run: task test
build:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
arch: [arm64, arm]
include:
- arch: arm64
goarch: arm64
- arch: arm
goarch: arm
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build
env:
GOOS: linux
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -o bin/bt-hid-relay-${{ matrix.arch }} ./cmd/bt-hid-relay/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bt-hid-relay-${{ matrix.arch }}
path: bin/bt-hid-relay-${{ matrix.arch }}
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Prepare assets
cd artifacts
for dir in */; do
chmod +x "$dir"*
tar czf "${dir%/}.tar.gz" -C "$dir" .
done
# Create release
gh release create ${{ github.ref_name }} \
--title "Release ${{ github.ref_name }}" \
--notes "Release ${{ github.ref_name }}" \
*.tar.gz