Skip to content

Commit 3ed4291

Browse files
committed
Allow manual PPA upload retries
1 parent 3059d28 commit 3ed4291

1 file changed

Lines changed: 91 additions & 12 deletions

File tree

.github/workflows/ppa-upload.yml

Lines changed: 91 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,53 @@ permissions:
66
on:
77
release:
88
types: [published]
9+
workflow_dispatch:
10+
inputs:
11+
tag_name:
12+
description: 'Release tag to package (e.g. v8.1.6)'
13+
required: true
14+
type: string
15+
source_ref:
16+
description: 'Git ref to build from'
17+
required: true
18+
default: master
19+
type: string
20+
ppa_revision:
21+
description: 'PPA-only Debian revision to append (e.g. 0ppa1)'
22+
required: true
23+
default: 0ppa1
24+
type: string
25+
series:
26+
description: 'Ubuntu series to upload'
27+
required: true
28+
default: resolute
29+
type: choice
30+
options:
31+
- resolute
32+
- noble
33+
- jammy
34+
- all
935
workflow_call:
1036
inputs:
1137
tag_name:
1238
description: 'Release tag (e.g. v8.0.0)'
1339
required: true
1440
type: string
41+
source_ref:
42+
description: 'Git ref to build from'
43+
required: false
44+
default: ''
45+
type: string
46+
ppa_revision:
47+
description: 'PPA-only Debian revision to append'
48+
required: false
49+
default: ''
50+
type: string
51+
series:
52+
description: 'Ubuntu series to upload'
53+
required: false
54+
default: all
55+
type: string
1556
secrets:
1657
GPG_PRIVATE_KEY:
1758
required: true
@@ -23,6 +64,8 @@ jobs:
2364
steps:
2465
- name: Check out repository
2566
uses: actions/checkout@v6
67+
with:
68+
ref: ${{ inputs.source_ref || github.ref }}
2669

2770
- name: Install packaging tools
2871
run: |
@@ -40,23 +83,49 @@ jobs:
4083
run: |
4184
printf '[amiberry-ppa]\nfqdn = ppa.launchpad.net\nmethod = ftp\nincoming = ~midwan-a/ubuntu/amiberry\nlogin = anonymous\nallow_unsigned_uploads = 0\n' > ~/.dput.cf
4285
86+
- name: Resolve PPA upload inputs
87+
env:
88+
TAG_INPUT: ${{ inputs.tag_name || github.event.release.tag_name }}
89+
PPA_REVISION_INPUT: ${{ inputs.ppa_revision }}
90+
run: |
91+
if [ -z "$TAG_INPUT" ]; then
92+
echo "Missing release tag input" >&2
93+
exit 1
94+
fi
95+
96+
if [ -n "$PPA_REVISION_INPUT" ] && ! [[ "$PPA_REVISION_INPUT" =~ ^[0-9A-Za-z.+~]+$ ]]; then
97+
echo "Invalid PPA revision: $PPA_REVISION_INPUT" >&2
98+
exit 1
99+
fi
100+
101+
{
102+
echo "PPA_TAG=$TAG_INPUT"
103+
echo "PPA_VERSION=${TAG_INPUT#v}"
104+
echo "PPA_REVISION=$PPA_REVISION_INPUT"
105+
} >> "$GITHUB_ENV"
106+
43107
- name: Build and upload source package for resolute
108+
if: ${{ (inputs.series || 'all') == 'all' || (inputs.series || 'all') == 'resolute' }}
44109
env:
45110
DEBEMAIL: midwan@gmail.com
46111
DEBFULLNAME: "Dimitris Panokostas"
47112
run: |
48-
TAG="${{ inputs.tag_name || github.event.release.tag_name }}"
49-
VERSION="${TAG#v}"
113+
PACKAGE_VERSION="$PPA_VERSION"
114+
RELEASE_MESSAGE="Release $PPA_VERSION"
115+
if [ -n "$PPA_REVISION" ]; then
116+
PACKAGE_VERSION="${PPA_VERSION}-${PPA_REVISION}"
117+
RELEASE_MESSAGE="Release $PPA_VERSION (PPA revision $PPA_REVISION)"
118+
fi
50119
51120
mkdir -p /tmp/ppa-build/resolute
52121
cp -r . /tmp/ppa-build/resolute/amiberry
53122
cd /tmp/ppa-build/resolute/amiberry
54123
55124
rm -f debian/changelog
56125
dch --create --package amiberry \
57-
--newversion "${VERSION}" \
126+
--newversion "$PACKAGE_VERSION" \
58127
--distribution resolute \
59-
"Release ${VERSION}"
128+
"$RELEASE_MESSAGE"
60129
61130
dpkg-buildpackage -S -d -us -uc
62131
@@ -66,22 +135,27 @@ jobs:
66135
dput amiberry-ppa /tmp/ppa-build/resolute/amiberry_*_source.changes
67136
68137
- name: Build and upload source package for noble
138+
if: ${{ (inputs.series || 'all') == 'all' || (inputs.series || 'all') == 'noble' }}
69139
env:
70140
DEBEMAIL: midwan@gmail.com
71141
DEBFULLNAME: "Dimitris Panokostas"
72142
run: |
73-
TAG="${{ inputs.tag_name || github.event.release.tag_name }}"
74-
VERSION="${TAG#v}"
143+
PACKAGE_VERSION="${PPA_VERSION}~noble1"
144+
RELEASE_MESSAGE="Release $PPA_VERSION (Ubuntu 24.04 Noble rebuild)"
145+
if [ -n "$PPA_REVISION" ]; then
146+
PACKAGE_VERSION="${PPA_VERSION}-${PPA_REVISION}~noble1"
147+
RELEASE_MESSAGE="Release $PPA_VERSION (Ubuntu 24.04 Noble PPA revision $PPA_REVISION)"
148+
fi
75149
76150
mkdir -p /tmp/ppa-build/noble
77151
cp -r . /tmp/ppa-build/noble/amiberry
78152
cd /tmp/ppa-build/noble/amiberry
79153
80154
rm -f debian/changelog
81155
dch --create --package amiberry \
82-
--newversion "${VERSION}~noble1" \
156+
--newversion "$PACKAGE_VERSION" \
83157
--distribution noble \
84-
"Release ${VERSION} (Ubuntu 24.04 Noble rebuild)"
158+
"$RELEASE_MESSAGE"
85159
86160
dpkg-buildpackage -S -d -us -uc
87161
@@ -91,22 +165,27 @@ jobs:
91165
dput amiberry-ppa /tmp/ppa-build/noble/amiberry_*_source.changes
92166
93167
- name: Build and upload source package for jammy
168+
if: ${{ (inputs.series || 'all') == 'all' || (inputs.series || 'all') == 'jammy' }}
94169
env:
95170
DEBEMAIL: midwan@gmail.com
96171
DEBFULLNAME: "Dimitris Panokostas"
97172
run: |
98-
TAG="${{ inputs.tag_name || github.event.release.tag_name }}"
99-
VERSION="${TAG#v}"
173+
PACKAGE_VERSION="${PPA_VERSION}~jammy1"
174+
RELEASE_MESSAGE="Release $PPA_VERSION (Ubuntu 22.04 Jammy rebuild)"
175+
if [ -n "$PPA_REVISION" ]; then
176+
PACKAGE_VERSION="${PPA_VERSION}-${PPA_REVISION}~jammy1"
177+
RELEASE_MESSAGE="Release $PPA_VERSION (Ubuntu 22.04 Jammy PPA revision $PPA_REVISION)"
178+
fi
100179
101180
mkdir -p /tmp/ppa-build/jammy
102181
cp -r . /tmp/ppa-build/jammy/amiberry
103182
cd /tmp/ppa-build/jammy/amiberry
104183
105184
rm -f debian/changelog
106185
dch --create --package amiberry \
107-
--newversion "${VERSION}~jammy1" \
186+
--newversion "$PACKAGE_VERSION" \
108187
--distribution jammy \
109-
"Release ${VERSION} (Ubuntu 22.04 Jammy rebuild)"
188+
"$RELEASE_MESSAGE"
110189
111190
dpkg-buildpackage -S -d -us -uc
112191

0 commit comments

Comments
 (0)