-
Notifications
You must be signed in to change notification settings - Fork 12
196 lines (172 loc) · 6.17 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Release
on:
push:
tags: [ 'v*' ]
permissions:
contents: write
jobs:
build-deps:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- target: x86-64-linux-gnu
cc: gcc
- target: arm-rpi-linux-gnueabihf
cc: arm-rpi-linux-gnueabihf-gcc
- target: arm-linux-gnueabihf
cc: arm-linux-gnueabihf-gcc
- target: aarch64-linux-gnu
cc: aarch64-linux-gnu-gcc
env:
CC: ${{ matrix.cc }}
steps:
- name: Install toolchain for ${{ matrix.target }}
if: ${{ matrix.target != 'arm-rpi-linux-gnueabihf' }}
run: sudo apt-get update && sudo apt-get install -y gcc-${{ matrix.target }}
- name: Install custom toolchain for ${{ matrix.target }}
if: ${{ matrix.target == 'arm-rpi-linux-gnueabihf' }}
run: |
wget https://github.com/devgianlu/rpi-toolchain/releases/download/v1/arm-rpi-linux-gnueabihf.tar.gz
sudo tar -C /usr --strip-components=1 -xzf arm-rpi-linux-gnueabihf.tar.gz
- name: Download alsa-lib sources
working-directory: /tmp
run: |
wget http://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.10.tar.bz2
tar -xvf alsa-lib-1.2.10.tar.bz2
- name: Compile alsa-lib for ${{ matrix.target }}
working-directory: /tmp
run: |
cd alsa-lib-1.2.10
./configure --enable-shared=yes --enable-static=no --with-pic \
--host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }}
make
sudo make install
- name: Download libogg sources
working-directory: /tmp
run: |
wget https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz
tar -xvf libogg-1.3.5.tar.xz
- name: Compile libogg for ${{ matrix.target }}
working-directory: /tmp
run: |
cd libogg-1.3.5
./configure --host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }}
make
sudo make install
- name: Download libvorbis sources
working-directory: /tmp
run: |
wget https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz
tar -xvf libvorbis-1.3.7.tar.xz
- name: Compile libvorbis for ${{ matrix.target }}
working-directory: /tmp
run: |
cd libvorbis-1.3.7
./configure --host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }}
make
sudo make install
- name: Package dependencies
run: mkdir /tmp/out && tar -C /tmp/deps -cvf /tmp/out/${{ matrix.target }}.tar ${{ matrix.target }}
- name: Upload compiled dependencies
uses: actions/upload-artifact@v3
with:
name: deps
path: /tmp/out
retention-days: 1
build:
runs-on: ubuntu-20.04
needs:
- build-deps
strategy:
matrix:
include:
- target: x86-64-linux-gnu
goarch: amd64
goamd64: v1
cc: gcc
tar: linux_x86_64
- target: arm-rpi-linux-gnueabihf
goarch: arm
goarm: 6
cc: arm-rpi-linux-gnueabihf-gcc
tar: linux_armv6_rpi
- target: arm-linux-gnueabihf
goarch: arm
goarm: 6
cc: arm-linux-gnueabihf-gcc
tar: linux_armv6
- target: aarch64-linux-gnu
goarch: arm64
cc: aarch64-linux-gnu-gcc
tar: linux_arm64
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: '1.20.8'
- name: Download compiled dependencies
uses: actions/download-artifact@v3
with:
name: deps
path: /tmp/deps
- name: Unpack compiled dependencies
run: sudo mkdir /tmp/deps/${{ matrix.target }} && sudo tar -C /tmp/deps/${{ matrix.target }} --strip-components=1 -xvf /tmp/deps/${{ matrix.target }}.tar
- name: Install build dependencies
if: ${{ matrix.target != 'arm-rpi-linux-gnueabihf' }}
run: sudo apt-get update && sudo apt-get install -y gcc-${{ matrix.target }}
- name: Install build dependencies for arm-rpi-linux-gnueabihf
if: ${{ matrix.target == 'arm-rpi-linux-gnueabihf' }}
working-directory: /tmp
run: |
wget https://github.com/devgianlu/rpi-toolchain/releases/download/v1/arm-rpi-linux-gnueabihf.tar.gz
sudo tar -C /usr --strip-components=1 -xzf arm-rpi-linux-gnueabihf.tar.gz
- name: Build with Go
env:
CGO_ENABLED: 1
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
GOAMD64: ${{ matrix.goamd64 }}
CC: ${{ matrix.cc }}
PKG_CONFIG_PATH: /tmp/deps/${{ matrix.target }}/lib/pkgconfig/
run: |
mkdir -p /tmp/out/${{ matrix.target }}/
go build \
-ldflags="-s -w -X go-librespot.commit=${{ github.sha }} -X go-librespot.version=${{ github.ref_name }}" \
-o ./go-librespot -a ./cmd/daemon
tar -zcvf /tmp/out/go-librespot_${{ matrix.tar }}.tar.gz go-librespot README.md
- name: Upload compiled binary
uses: actions/upload-artifact@v3
with:
name: binaries
path: /tmp/out
retention-days: 1
publish:
runs-on: ubuntu-20.04
needs:
- build
steps:
- name: Download compiled binaries
uses: actions/download-artifact@v3
with:
name: binaries
path: /tmp/out
- name: Generate changelog
uses: jaywcjlove/changelog-generator@main
id: changelog
with:
token: ${{ secrets.GITHUB_TOKEN }}
filter-author: (dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
- name: Release binaries
uses: softprops/action-gh-release@v1
with:
body: |
${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
files: /tmp/out/*