forked from deluge-torrent/deluge
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (124 loc) · 3.76 KB
/
deb.yml
File metadata and controls
141 lines (124 loc) · 3.76 KB
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
name: Debian Packages
on:
push:
branches:
- squall
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
epoch: ${{ steps.epoch.outputs.epoch }}
steps:
- name: Generate build timestamp
id: epoch
run: echo "epoch=$(date +%s)" >> $GITHUB_OUTPUT
build-deb:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
include:
- distro: debian
version: trixie
image: debian:trixie
- distro: ubuntu
version: noble
image: ubuntu:24.04
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Enable universe (Ubuntu only)
if: matrix.distro == 'ubuntu'
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y universe
- name: Install build dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
debhelper \
dh-virtualenv \
intltool \
python3 \
python3-dev \
python3-gi \
python3-gi-cairo \
python3-libtorrent \
unzip
- name: Inject build version
env:
EPOCH: ${{ needs.setup.outputs.epoch }}
CODENAME: ${{ matrix.version }}
run: |
PKG_VER=$(dpkg-parsechangelog -S Version)
BASE_VER="${PKG_VER%-*}"
NEW_VER="${BASE_VER}+${CODENAME}.${EPOCH}-1"
sed -i "1s/${PKG_VER}/${NEW_VER}/" debian/changelog
- name: Build packages
run: dpkg-buildpackage -us -uc -b
- name: Rename to debrepo format
env:
CODENAME: ${{ matrix.version }}
run: |
mkdir -p dist
for deb in ../*.deb; do
base=$(basename "$deb")
pkg=$(echo "$base" | cut -d_ -f1)
ver_rev=$(echo "$base" | cut -d_ -f2)
arch=$(echo "$base" | cut -d_ -f3 | sed 's/\.deb//')
ver=$(echo "$ver_rev" | sed 's/-[^-]*$//')
mv "$deb" "dist/${pkg}_${ver}_${CODENAME}_${arch}.deb"
done
- uses: actions/upload-artifact@v4
with:
name: debs-${{ matrix.distro }}-${{ matrix.version }}
path: dist/*.deb
publish:
needs: [setup, build-deb]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Get release tag
id: tag
env:
EPOCH: ${{ needs.setup.outputs.epoch }}
run: |
PKG_VER=$(dpkg-parsechangelog -S Version)
BASE_VER="${PKG_VER%-*}"
VERSION=$(echo "${BASE_VER}+${EPOCH}" | sed 's/~/./' | sed 's/+/./')
echo "tag=squall-${VERSION}" >> $GITHUB_OUTPUT
- name: Publish to GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.tag.outputs.tag }}
run: |
gh release create "$TAG" \
--title "Squall packages ($TAG)" \
--prerelease \
--notes "Automated deb build" 2>/dev/null || true
gh release upload "$TAG" dist/*.deb --clobber
- name: Prune old releases (keep latest 3)
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release list --json tagName --jq '.[].tagName' \
| grep '^squall-' \
| tail -n +4 \
| xargs -I{} gh release delete {} --yes --cleanup-tag