-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (158 loc) · 6.14 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Package
on:
release:
types: [ created ]
jobs:
cross-compile:
strategy:
fail-fast: false
matrix:
os: [ linux, freebsd ]
arch: [ 386, amd64, arm, arm64 ]
name: Crosscompile - ${{matrix.os}}-${{matrix.arch}}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: compile
id: compile
run: |
mkdir -p build/bundle/{bin,logs}
GOOS=${{matrix.os}} GOARCH=${{matrix.arch}} make -e DESTDIR=build/bundle PREFIX= CFGDIR= install install-scripts
tar -C build/bundle -z -cf build/bundle.tar.gz .
echo "version=$(sed -n 's/.*PROGRAM_VERSION\s*=\s*//p' Makefile)" >> "$GITHUB_OUTPUT"
- name: Upload thalos-server
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-server-${{steps.compile.outputs.version}}-${{matrix.os}}-${{matrix.arch}}
asset_path: build/thalos-server
asset_content_type: application/octal-stream
- name: Upload thalos-tools
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-tools-${{steps.compile.outputs.version}}-${{matrix.os}}-${{matrix.arch}}
asset_path: build/thalos-tools
asset_content_type: application/octal-stream
- name: Upload bundle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-${{steps.compile.outputs.version}}-${{matrix.os}}-${{matrix.arch}}.tar.gz
asset_path: build/bundle.tar.gz
asset_content_type: application/tar+gzip
# Build thalos binaries that are linked with musl libc.
musl:
strategy:
fail-fast: false
matrix:
arch: [ 386, amd64, arm, arm64 ]
runs-on: ubuntu-latest
name: Build musl (${{ matrix.arch }})
container:
image: golang:1.21-alpine3.19
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: apk add make
- name: compile
id: compile
run: |
mkdir -p build/bundle/{bin,logs}
GOARCH=${{matrix.arch}} make -e DESTDIR=build/bundle PREFIX= CFGDIR= install install-scripts
tar -C build/bundle -z -cf build/bundle.tar.gz .
echo "version=$(sed -n 's/.*PROGRAM_VERSION\s*=\s*//p' Makefile)" >> "$GITHUB_OUTPUT"
- name: Upload thalos-server
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-server-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl
asset_path: build/thalos-server
asset_content_type: application/octal-stream
- name: Upload thalos-tools
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-tools-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl
asset_path: build/thalos-tools
asset_content_type: application/octal-stream
- name: Upload bundle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: thalos-${{steps.compile.outputs.version}}-linux-${{matrix.arch}}-musl.tar.gz
asset_path: build/bundle.tar.gz
asset_content_type: application/tar+gzip
package-ubuntu:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
name: Package - ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Install build dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential fakeroot debhelper quilt
- name: Package
id: package
run: |
make build-deb
DEB_FILE=$(ls ../*.deb | head -1)
echo "deb_filename=$DEB_FILE" >> "$GITHUB_OUTPUT"
echo "deb_name=$(basename $DEB_FILE)" >> "$GITHUB_OUTPUT"
CH_FILE=$(ls ../*.changes | head -1)
echo "ch_filename=$CH_FILE" >> "$GITHUB_OUTPUT"
echo "ch_name=$(basename $CH_FILE)" >> "$GITHUB_OUTPUT"
INFO_FILE=$(ls ../*.buildinfo | head -1)
echo "info_filename=$INFO_FILE" >> "$GITHUB_OUTPUT"
echo "info_name=$(basename $INFO_FILE)" >> "$GITHUB_OUTPUT"
- name: Upload (package)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.package.outputs.deb_name }}
asset_path: ${{ steps.package.outputs.deb_filename }}
asset_content_type: application/x-deb
- name: Upload (.changes)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.package.outputs.ch_name }}
asset_path: ${{ steps.package.outputs.ch_filename }}
asset_content_type: text/plain
- name: Upload (buildinfo)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.package.outputs.info_name }}
asset_path: ${{ steps.package.outputs.info_filename }}
asset_content_type: text/plain