-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (47 loc) · 1.55 KB
/
build.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
name: Build and Release
permissions:
contents: write
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Run Tests
run: go test -v ./...
- name: Build Binaries
run: |
# Create dist directory
mkdir -p dist
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o dist/apkx-linux-amd64 ./cmd/apkx/main.go
tar czf dist/apkx-linux-amd64.tar.gz -C dist apkx-linux-amd64 LICENSE README.md config/
# Build for Windows
GOOS=windows GOARCH=amd64 go build -o dist/apkx-windows-amd64.exe ./cmd/apkx/main.go
zip -j dist/apkx-windows-amd64.zip dist/apkx-windows-amd64.exe LICENSE README.md
cp -r config dist/config-windows
zip -r dist/apkx-windows-amd64.zip dist/config-windows
# Build for macOS
GOOS=darwin GOARCH=amd64 go build -o dist/apkx-darwin-amd64 ./cmd/apkx/main.go
tar czf dist/apkx-darwin-amd64.tar.gz -C dist apkx-darwin-amd64 LICENSE README.md config/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.zip
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}