-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 2.54 KB
/
release.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Release Binaries
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
goos: linux
goarch: amd64
- os: linux
arch: arm64
goos: linux
goarch: arm64
- os: darwin
arch: amd64
goos: darwin
goarch: amd64
- os: darwin
arch: arm64
goos: darwin
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -v -o copepod-${{ matrix.os }}-${{ matrix.arch }}
chmod +x copepod-${{ matrix.os }}-${{ matrix.arch }}
- name: Generate SHA-256
run: |
sha256sum copepod-${{ matrix.os }}-${{ matrix.arch }} > copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
path: |
copepod-${{ matrix.os }}-${{ matrix.arch }}
copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Create release notes
echo "Release $VERSION" > release_notes.md
echo "" >> release_notes.md
echo "## SHA-256 Checksums" >> release_notes.md
echo '```' >> release_notes.md
cat *.sha256 >> release_notes.md
echo '```' >> release_notes.md
# Create release using gh cli
gh release create "$VERSION" \
--repo "$GITHUB_REPOSITORY" \
--title "Copepod $VERSION" \
--notes-file release_notes.md \
copepod-*