-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (72 loc) · 2.92 KB
/
go.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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
release:
types: [published]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.1'
- name: Advance Version
if: github.event_name == 'release' && github.event.action == 'published'
run: |
cat <<< $(jq '.version="${{github.event.release.tag_name}}"' internal/config/config.json) > internal/config/config.json
- name: Build Linux AMD64
if: github.event_name == 'release' && github.event.action == 'published'
env:
GOOS: "linux"
GOARCH: "amd64"
BINARY: "linux-amd64"
run: |
export FILENAME=krknctl-${{github.event.release.tag_name}}-$BINARY.tar.gz
sudo apt-get update && sudo apt-get install btrfs-tools
go build -tags containers_image_openpgp -ldflags="-w -s" -o $BINARY/ ./...
tar cfvz $FILENAME -C $BINARY krknctl
gh release upload ${{github.event.release.tag_name}} $FILENAME
- name: Build Linux ARM64
if: github.event_name == 'release' && github.event.action == 'published'
env:
GOOS: "linux"
GOARCH: "arm64"
BINARY: "linux-amd64"
run: |
export FILENAME=krknctl-${{github.event.release.tag_name}}-$BINARY.tar.gz
sudo apt-get update && sudo apt-get install btrfs-tools
go build -tags containers_image_openpgp -ldflags="-w -s" -o $BINARY/ ./...
tar cfvz $FILENAME -C $BINARY krknctl
gh release upload ${{github.event.release.tag_name}} $FILENAME
- name: Build Darwin ARM64
if: github.event_name == 'release' && github.event.action == 'published'
env:
GOOS: "darwin"
GOARCH: "arm64"
BINARY: "darwin-arm64"
run: |
export FILENAME=krknctl-${{github.event.release.tag_name}}-$BINARY.tar.gz
sudo apt-get update && sudo apt-get install btrfs-tools
go build -tags containers_image_openpgp -ldflags="-w -s" -o $BINARY/ ./...
tar cfvz $FILENAME -C $BINARY krknctl
gh release upload ${{github.event.release.tag_name}} $FILENAME
- name: Build Darwin AMD64
if: github.event_name == 'release' && github.event.action == 'published'
env:
GOOS: "darwin"
GOARCH: "amd64"
BINARY: "darwin-arm64"
run: |
export FILENAME=krknctl-${{github.event.release.tag_name}}-$BINARY.tar.gz
sudo apt-get update && sudo apt-get install btrfs-tools
go build -tags containers_image_openpgp -ldflags="-w -s" -o $BINARY/ ./...
tar cfvz $FILENAME -C $BINARY krknctl
gh release upload ${{github.event.release.tag_name}} $FILENAME
- name: Test
if: github.event_name == 'pull_request'
run: |
go test -v ./...