-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.13 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
name: Build and Release
on:
# Trigger the workflow on a push with a tag starting with 'v'
push:
tags:
- 'v*'
# Allow manual trigger
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go-version: ["1.22.x"]
arch: [amd64]
package: [flower, flower-tui]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Go environment
uses: actions/setup-go@v5
with:
cache: true
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go get -v -t -d ./...
- name: Build ${{ matrix.package }} for ${{ matrix.os }} (${{ matrix.arch }})
run: |
mkdir -p build/
GOOS=$(if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then echo "linux"; else echo "windows"; fi) GOARCH=${{ matrix.arch }} go build -v \
-o build/${{ matrix.package }} \
./cmd/${{ matrix.package }}
- name: Archive build artifact
uses: actions/upload-artifact@v4
with:
compression-level: 0
if-no-files-found: error
name: ${{ matrix.package }}-${{ matrix.os }}-${{ matrix.arch }}
path: build/${{ matrix.package }}
release:
name: Release
permissions:
contents: write
runs-on: ubuntu-latest
needs: [build]
steps:
# Without this, "gh" explodes spectacularily
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: build/
- name: Upload Binaries
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tagname="${GITHUB_REF#refs/tags/}"
echo "Tag name is $tagname"
ls -lR build/*
echo "Uploading release assets..."
files=$(for f in build/*; do
echo -n " $f"
done)
echo "Files are $files"
GH_DEBUG=api gh release create "$tagname" -t "$tagname" $files