-
Notifications
You must be signed in to change notification settings - Fork 69
139 lines (120 loc) · 3.96 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Special thanks to @RiccardoM (https://github.com/riccardoM)
# https://github.com/desmos-labs/desmos/blob/master/.github/workflows/release.yml
name: Release
# Release workflow builds the binaries for a release, and then publishes them to a newly created GitHub release.
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Setup Go 🧰
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Unshallow
run: git fetch --prune --unshallow --tags --force
- name: Create release 📜
uses: goreleaser/[email protected]
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-macos:
name: Build MacOS binary
runs-on: macos-10.15
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow --tags --force
- name: Set variables
run: |
echo "VERSION=$(git describe --always | sed 's/^v//')" >> $GITHUB_ENV
- name: Setup Go 🧰
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Build the binary 🏭
run: |
LEDGER_ENABLED=true make build
mv build/bitsongd "build/bitsongd-$VERSION-darwin-amd64"
- name: Upload the artifacts 📤
uses: actions/upload-artifact@v3
with:
name: "darwin-amd64"
path: "build/*darwin*amd64*"
build-linux:
name: Build Linux binaries
runs-on: ubuntu-18.04
strategy:
matrix:
go-arch: ["amd64", "arm64"]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --prune --unshallow --tags --force
- name: Set variables
run: |
echo "VERSION=$(git describe --always | sed 's/^v//')" >> $GITHUB_ENV
- name: Setup Go 🧰
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Compute diff 📜
uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Build 🔨
run: |
GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=true make build
mv build/bitsongd "build/bitsongd-$VERSION-linux-${{ matrix.go-arch }}"
- name: Upload the linux/amd64 artifact 📤
uses: actions/upload-artifact@v3
with:
name: "linux-amd64"
path: "build/*linux*amd64*"
- name: Upload the linux/arm64 artifact 📤
uses: actions/upload-artifact@v3
with:
name: "linux-arm64"
path: "build/*linux*arm64*"
build-windows:
name: Build Windows binary
runs-on: windows-latest
steps:
- name: Setting up dependencies
run: |
choco install make
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --prune --unshallow --tags --force
- name: Set variables
run: |
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$(git describe --always | sed 's/^v//')"
- name: Setup Go 🧰
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Build the binary 🏭
run: |
make LEDGER_ENABLED=true build
echo "build/bitsongd-$env:VERSION-$env:COMMIT-windows-amd64.exe"
mv build/bitsongd.exe "build/bitsongd-$env:VERSION-windows-amd64.exe"
- name: Upload the artifacts 📤
uses: actions/upload-artifact@v3
with:
name: "windows-amd64"
path: "build/*windows*amd64*"