blob: 1fb6603b8c63e682861f7c099774992a46e20481 (
plain)
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
|
name: Build & Release Go App (CGO Enabled)
on:
push:
branches: [ main ]
jobs:
build:
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm # use the label provided by GitHub for native arm64
runs-on: ${{ matrix.runner }}
env:
GOOS: linux
CGO_ENABLED: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build binary for ${{ matrix.arch }}
run: |
echo "Building for GOARCH=${{ matrix.arch }}"
go build -v -o v2stat-${{ matrix.arch }} .
env:
GOARCH: ${{ matrix.arch }}
- name: Upload artifact for ${{ matrix.arch }}
uses: actions/upload-artifact@v3
with:
name: v2stat-${{ matrix.arch }}
path: v2stat-${{ matrix.arch }}
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v0.0.0-dev${{ github.run_number }}
release_name: Release v0.0.0-dev${{ github.run_number }}
draft: false
prerelease: false
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload amd64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/v2stat-amd64
asset_name: v2stat-amd64
asset_content_type: application/octet-stream
- name: Upload arm64 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/v2stat-arm64
asset_name: v2stat-arm64
asset_content_type: application/octet-stream
|