-
Notifications
You must be signed in to change notification settings - Fork 19
121 lines (101 loc) · 3.86 KB
/
linux.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
name: linux build
on:
workflow_call:
workflow_dispatch:
env:
BUILD_ARCHS: "aarch64 armel armhf i686 mipseb mipsel ppc500 ppc6xx riscv64 x86_64"
BUILD_TYPES: ${{ (github.ref_name == 'develop' || github.ref_name == 'main') && 'release debug' || 'release' }}
BUILD_TESTING: ${{ (github.ref_name != 'main') && 'testing' || '' }}
jobs:
prepare-build-matrix:
runs-on: ubuntu-24.04
outputs:
archs: ${{ steps.matrix-vars.outputs.ARCHS }}
types: ${{ steps.matrix-vars.outputs.TYPES }}
steps:
- name: Calculate matrix variables
id: matrix-vars
run: |
echo ARCHS=[\"$BUILD_ARCHS\"] | sed 's| |","|g' >> "$GITHUB_OUTPUT"
echo TYPES=[\"$BUILD_TYPES\"] | sed 's| |","|g' >> "$GITHUB_OUTPUT"
build-bin:
runs-on: ubuntu-24.04
needs: prepare-build-matrix
strategy:
matrix:
arch: ${{ fromJSON(needs.prepare-build-matrix.outputs.archs) }}
type: ${{ fromJSON(needs.prepare-build-matrix.outputs.types) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare ${{ matrix.arch }} / ${{ matrix.type }} environment
run: |
sudo mkdir -p /build
sudo chown $USER:$USER /build
mkdir -p /build/buildroot
mkdir -p /build/lib
curl -L https://github.com/nzbgetcom/build-files/releases/download/v1.0/buildroot-${{ matrix.arch }}.tar.gz -o /build/buildroot/buildroot.tar.gz
curl -L https://github.com/nzbgetcom/build-files/releases/download/v1.0/lib-${{ matrix.arch }}.tar.gz -o /build/lib/lib.tar.gz
tar zxf /build/buildroot/buildroot.tar.gz -C /build/buildroot
tar zxf /build/lib/lib.tar.gz -C /build/lib
sudo apt-get update
sudo apt-get install -y autoconf automake bc build-essential cmake cpio curl file git libtool pkg-config rsync unzip wget libtinfo6
- name: Build
run: bash linux/build-nzbget.sh bin ${{ matrix.arch }} ${{ matrix.type }} ${{ env.BUILD_TESTING }}
- name: Upload full build log on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-linux-${{ matrix.arch }}-${{ matrix.type }}-build-log
path: build/*/build.log
retention-days: 5
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-${{ matrix.arch }}-${{ matrix.type }}-bin
path: build/*.tar.gz
retention-days: 5
build-installer:
runs-on: ubuntu-24.04
needs: build-bin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare build environment
run: |
sudo mkdir -p /build
sudo chown $USER:$USER /build
curl -L https://github.com/nzbgetcom/build-files/releases/download/v1.0/linux-unpack.tar.gz -o /build/unpack.tar.gz
tar zxf /build/unpack.tar.gz -C /build
- name: Download build artifacts
uses: actions/download-artifact@v4
- name: Build installer
run: |
mkdir -p build
for ARCH in ${{ env.BUILD_ARCHS }}; do
for TYPE in ${{ env.BUILD_TYPES }}; do
cp nzbget-$ARCH-$TYPE-bin/*.tar.gz build/
done
done
bash linux/build-nzbget.sh linux installer ${{ env.BUILD_TYPES }} ${{ env.BUILD_TESTING }}
- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
cd build
SUFFIX="-${GITHUB_REF_NAME/\//-}-bin-linux"
for FILE in *.run; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/-bin-linux/$SUFFIX}
mv $FILE $NEW_FILE
done
- name: Delete unneeded platform-specific artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
nzbget-*-*-bin
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-linux-installers
path: build/*.run
retention-days: 5