-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (110 loc) · 4.2 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
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
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