-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
76 lines (63 loc) · 2.33 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Build binaries
run: |
VERSION=${GITHUB_REF#refs/tags/}
COMMIT=$(git rev-parse HEAD)
LDFLAGS="-s -w -X github.com/lancher-dev/lancher/internal/version.Version=${VERSION} -X github.com/lancher-dev/lancher/internal/version.Commit=${COMMIT}"
# Build for all platforms
GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o lancher-linux-amd64 ./cmd/lancher
GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o lancher-linux-arm64 ./cmd/lancher
GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o lancher-darwin-amd64 ./cmd/lancher
GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o lancher-darwin-arm64 ./cmd/lancher
- name: Generate checksums
id: checksums
run: |
CHECKSUMS=$(sha256sum lancher-linux-amd64 lancher-linux-arm64 lancher-darwin-amd64 lancher-darwin-arm64)
echo "checksums<<EOF" >> $GITHUB_OUTPUT
echo "$CHECKSUMS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Extract individual checksums for AUR
SHA256_X86_64=$(sha256sum lancher-linux-amd64 | awk '{print $1}')
SHA256_AARCH64=$(sha256sum lancher-linux-arm64 | awk '{print $1}')
echo "sha256_x86_64=${SHA256_X86_64}" >> $GITHUB_OUTPUT
echo "sha256_aarch64=${SHA256_AARCH64}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
lancher-linux-amd64
lancher-linux-arm64
lancher-darwin-amd64
lancher-darwin-arm64
draft: false
prerelease: false
generate_release_notes: true
append_body: true
body: |
<details>
<summary>Checksums (SHA256)</summary>
```
${{ steps.checksums.outputs.checksums }}
```
</details>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}