-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (63 loc) · 1.73 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (63 loc) · 1.73 KB
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
name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, windows, darwin]
arch: [amd64, arm64]
outputs:
tag_name: ${{ steps.extract_tag.outputs.TAG_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Extract tag
id: extract_tag
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build binary
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
mkdir -p dist
EXT=""
if [ "${GOOS}" = "windows" ]; then EXT=".exe"; fi
OUT="protoprobe-${{ env.TAG_NAME }}-${GOOS}-${GOARCH}${EXT}"
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "-s -w" -o dist/$OUT ./cmd/protoprobe
- name: Generate checksum
run: |
cd dist
sha256sum * > checksums-${{ matrix.os }}-${{ matrix.arch }}.txt
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: protoprobe-${{ matrix.os }}-${{ matrix.arch }}
path: dist/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: List downloaded files
run: ls -R dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Prebuilt binaries and checksums
files: dist/**/* # upload all binaries + checksums