-
Notifications
You must be signed in to change notification settings - Fork 70
128 lines (114 loc) · 4.13 KB
/
Copy pathrelease-dev.yml
File metadata and controls
128 lines (114 loc) · 4.13 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
name: Release (develop, bookworm-dev)
# Builds and publishes python3-probe-basic on every push to main.
# Replaces the buildbot's probe_basic_pyqt5_{x86,arm64}_dev_factory.py
# builders + do_apt_bookworm_dev.sh/do_apt_develop.sh.
on:
push:
branches:
- main
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
container:
image: debian:bookworm
steps:
- name: Install build prerequisites
run: |
apt-get update
apt-get install -y --no-install-recommends \
git ca-certificates build-essential devscripts dpkg-dev python3-pip
- name: Add kcjengr/apt as a build-time package source
run: |
echo "deb [trusted=yes] https://raw.githubusercontent.com/kcjengr/apt/main/apt bookworm-dev main" \
> /etc/apt/sources.list.d/kcjengr.list
apt-get update
- name: Checkout source
uses: actions/checkout@v7
with:
path: source
fetch-depth: 0
fetch-tags: true
- name: Install package build-deps
working-directory: source
run: |
apt-get build-dep -y .
pip install --break-system-packages "poetry-dynamic-versioning>=1.0.0,<2.0.0"
- name: Create changelog entry
working-directory: source
env:
EMAIL: lcvette1@gmail.com
run: |
LATEST_TAG="$(git describe --abbrev=0 --tags)"
COUNT="$(git rev-list --count "${LATEST_TAG}..HEAD")"
VERSION="${LATEST_TAG#v}-${COUNT}.dev"
rm -f debian/changelog
dch --create --distribution unstable --package probe-basic \
--newversion "${VERSION}" "Unstable Release version."
- name: Build package
working-directory: source
env:
DEB_BUILD_OPTIONS: nocheck
run: dpkg-buildpackage -b -uc
- name: Upload built package
uses: actions/upload-artifact@v7
with:
name: probe-basic-bookworm-dev-${{ matrix.arch }}
path: '*.deb'
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download built packages
uses: actions/download-artifact@v8
with:
pattern: probe-basic-bookworm-dev-*
path: debs
merge-multiple: true
- name: Checkout apt repo
uses: actions/checkout@v7
with:
repository: kcjengr/apt
path: apt-repo
token: ${{ secrets.APT_REPO_TOKEN }}
- name: Import GPG signing key
run: echo "${{ secrets.APT_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
- name: Publish suite(s) and push (retries on concurrent-publish races)
working-directory: apt-repo
env:
GPG_KEY_ID: 0CDFCCE0388CFA48
run: |
set -euo pipefail
git config user.name "kcjengr-bot"
git config user.email "actions@github.com"
for attempt in 1 2 3 4 5; do
mkdir -p "apt/pool/main/bookworm-dev"
cp ../debs/*.deb "apt/pool/main/bookworm-dev/"
./scripts/publish-suite.sh bookworm-dev bookworm-dev amd64 arm64
./scripts/publish-suite.sh develop bookworm-dev amd64 arm64
git add -A
if git diff --cached --quiet; then
echo "no changes to publish"
exit 0
fi
git commit -m "Publish probe-basic dev build ${{ github.sha }} (bookworm-dev/develop)"
if git push; then
echo "published on attempt ${attempt}"
exit 0
fi
echo "push rejected (attempt ${attempt}/5) -- another repo published to kcjengr/apt at the same time, re-syncing and retrying"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin "$branch"
git reset --hard "origin/$branch"
sleep $(( (RANDOM % 8) + attempt * 2 ))
done
echo "::error::failed to push to kcjengr/apt after 5 attempts"
exit 1