chore: verify host mode available and enabled #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
cache: false | |
- 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' | |
cache: false | |
- 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 |