5
5
if : startsWith(github.ref, 'refs/heads/main')
6
6
runs-on : ubuntu-latest
7
7
steps :
8
- - uses : actions/checkout@v2
9
- - uses : actions/setup-go@v2
10
- with :
11
- go-version : ' ^1.13.1 '
12
- - name : go test
13
- run : go test -v ./...
8
+ - uses : actions/checkout@v3
9
+ - uses : actions/setup-go@v4
10
+ with :
11
+ go-version : " ^1.19.1 "
12
+ - name : go test
13
+ run : go test -v ./...
14
14
test_build_release :
15
15
if : startsWith(github.ref, 'refs/tags/')
16
16
runs-on : ubuntu-latest
17
17
steps :
18
- - uses : actions/checkout@v2
19
- - uses : actions/setup-go@v2
20
- with :
21
- go-version : ' ^1.13.1'
22
- - name : Get the version
23
- id : get_tag
24
- run : echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
25
- - name : go test
26
- run : go test -v ./...
27
- - name : build
28
- shell : bash
29
- run : |
30
- # Make an artifacts directory
31
- mkdir -p artifacts
32
-
33
- # run the build for each supported OS
34
- for os in "linux" "darwin" "windows"; do
35
- echo "Building for $os..."
36
- GOOS=$os CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_${os} .
37
-
38
- # If its windows we need to rename it to have .exe at the end.
39
- if [ $os == "windows" ]; then
40
- mv ./artifacts/launch_$os ./artifacts/launch_$os.exe
41
- fi
42
- done
43
- # Make an Arm bin for linux also
44
- for arch in arm64 arm; do
45
- echo "Building for linux on $arch..."
46
- GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_linux_${arch} .
47
- done
18
+ - uses : actions/checkout@v3
19
+ - uses : actions/setup-go@v4
20
+ with :
21
+ go-version : " ^1.19.1"
22
+ - name : Get the version
23
+ id : get_tag
24
+ run : echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
25
+ - name : go test
26
+ run : go test -v ./...
27
+ - name : build
28
+ shell : bash
29
+ run : |
30
+ # Make an artifacts directory
31
+ mkdir -p artifacts
48
32
49
- - name : Release
50
- uses : softprops/action-gh-release@v1
51
- with :
52
- files : artifacts/*
53
- body_path : .github/workflows/release_body.md
54
- env :
55
- GITHUB_TOKEN : ${{ github.token }}
33
+ # Run the build for each supported OS using x86_64.
34
+ # Building for windows.
35
+ echo "Building for Windows on amd64..."
36
+ GOOS=$os GOARCH=amd64 CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_windows.exe .
37
+
38
+ # Make an ARM and ARM64 bin for linux and Mac.
39
+ for os in "linux" "darwin"; do
40
+ for arch in "amd64" "arm64" "arm"; do
41
+ echo "Building for $os on $arch..."
42
+ if [ "$os" = "darwin" ] && [ "$arch" = "arm" ]; then
43
+ echo "Skipping $os on $arch..."
44
+ continue
45
+ fi
46
+ GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_${os}_${arch} .
47
+ done
48
+ done
49
+
50
+ - name : Release
51
+ uses : softprops/action-gh-release@v1
52
+ with :
53
+ files : artifacts/*
54
+ body_path : .github/workflows/release_body.md
55
+ env :
56
+ GITHUB_TOKEN : ${{ github.token }}
0 commit comments