@@ -100,6 +100,10 @@ jobs:
100100 needs : [dist, test-dist]
101101 runs-on : ubuntu-latest
102102 if : startsWith(github.ref, 'refs/tags/v')
103+ strategy :
104+ fail-fast : true
105+ matrix :
106+ series : [focal, jammy, noble]
103107
104108 steps :
105109 - name : Install dependencies
@@ -118,6 +122,8 @@ jobs:
118122 name : packaging-assets
119123
120124 - name : Assemble Debian source tree
125+ env :
126+ SERIES : ${{ matrix.series }}
121127 run : |
122128 tar xzf try-*.tgz
123129 srcdir=$(echo try-*/)
@@ -130,10 +136,30 @@ jobs:
130136 cp -R packaging/debian "$srcdir/debian"
131137 rm -f try-*.tgz packaging.tgz
132138
133- revision=$(sed -n "1s/^try ([^)-]*-\([0-9]*\)).*/\1/p" "$srcdir/debian/changelog")
134- sed -i "1s/^try ([^)]*)/try (${version}-${revision})/" "$srcdir/debian/changelog"
135-
136- sed -i "1s/UNRELEASED/noble/" "$srcdir/debian/changelog"
139+ changelog="$srcdir/debian/changelog"
140+ committed=$(sed -n '1s/^try (\([^)]*\)).*/\1/p' "$changelog")
141+ if [ "${committed%-*}" = "$version" ]
142+ then
143+ # same upstream version: packaging-only revision, keep the committed one
144+ revision=${committed##*-}
145+ else
146+ # new upstream release: start again at revision 1
147+ revision=1
148+ maintainer=$(sed -n 's/^Maintainer: //p' "$srcdir/debian/control")
149+ {
150+ echo "try (${version}-1) UNRELEASED; urgency=medium"
151+ echo
152+ echo " * New upstream release ${version}."
153+ echo
154+ echo " -- ${maintainer} $(date -R)"
155+ echo
156+ cat "$changelog"
157+ } > "$changelog.new"
158+ mv "$changelog.new" "$changelog"
159+ fi
160+ sed -i "1s/^try ([^)]*)/try (${version}-${revision}~${SERIES}1)/" "$changelog"
161+
162+ sed -i "1s/UNRELEASED/${SERIES}/" "$changelog"
137163 echo "SRCDIR=$srcdir" >> "$GITHUB_ENV"
138164
139165 - name : Build the Debian source package
@@ -148,7 +174,7 @@ jobs:
148174 - name : Upload Debian source package
149175 uses : actions/upload-artifact@v7
150176 with :
151- name : try-ppa-source
177+ name : try-ppa-source-${{ matrix.series }}
152178 path : |
153179 try_*.dsc
154180 try_*.orig.tar.gz
@@ -446,12 +472,13 @@ jobs:
446472 - name : Install dependencies
447473 run : |
448474 sudo apt-get update
449- sudo apt-get install -y devscripts dput gnupg
475+ sudo apt-get install -y devscripts dput gnupg openssh-client python3-paramiko
450476
451- - name : Download the Debian source package
477+ - name : Download the Debian source packages
452478 uses : actions/download-artifact@v8
453479 with :
454- name : try-ppa-source
480+ pattern : try-ppa-source-*
481+ merge-multiple : true
455482
456483 - name : Import GPG signing key
457484 env :
@@ -460,14 +487,57 @@ jobs:
460487 echo "$GPG_PRIVATE_KEY" | gpg --batch --import
461488 echo "KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/ {print $5; exit}')" >> "$GITHUB_ENV"
462489
490+ - name : Configure SFTP upload to Launchpad
491+ env :
492+ SSH_KEY : ${{ secrets.PPA_SSH_KEY }}
493+ PPA_TARGET : ${{ vars.PPA_TARGET }}
494+ PPA_LOGIN : ${{ vars.PPA_LOGIN }}
495+ run : |
496+ mkdir -p ~/.ssh
497+ chmod 700 ~/.ssh
498+ echo "$SSH_KEY" > ~/.ssh/id_ed25519
499+ chmod 600 ~/.ssh/id_ed25519
500+ ssh-keyscan ppa.launchpad.net >> ~/.ssh/known_hosts
501+ ssh-keygen -lf ~/.ssh/known_hosts
502+
503+ ppa=${PPA_TARGET#ppa:}
504+ owner=${ppa%%/*}
505+ name=${ppa#*/}
506+ cat > ~/.dput.cf <<EOF
507+ [ppa-sftp]
508+ fqdn = ppa.launchpad.net
509+ method = sftp
510+ incoming = ~${owner}/ubuntu/${name}/
511+ login = ${PPA_LOGIN:-$owner}
512+ allow_unsigned_uploads = 0
513+ EOF
514+
463515 - name : Sign and upload to the PPA
464516 env :
465517 GPG_PASSPHRASE : ${{ secrets.PPA_GPG_PASSPHRASE }}
466518 run : |
467519 echo "$GPG_PASSPHRASE" > /tmp/gpg-passphrase
468- debsign -k"$KEYID" -p"gpg --batch --yes --pinentry-mode loopback --passphrase-file /tmp/gpg-passphrase" try_*_source.changes
520+ failed=""
521+ for changes in try_*_source.changes
522+ do
523+ debsign -k"$KEYID" -p"gpg --batch --yes --pinentry-mode loopback --passphrase-file /tmp/gpg-passphrase" "$changes"
524+ uploaded=""
525+ for attempt in 1 2 3 4 5
526+ do
527+ if dput ppa-sftp "$changes"
528+ then
529+ uploaded=yes
530+ break
531+ fi
532+ echo "upload of $changes failed (attempt $attempt); retrying in 60s"
533+ sleep 60
534+ done
535+ [ -n "$uploaded" ] || failed="$failed $changes"
536+ # give Launchpad's upload server time to finish the previous upload
537+ sleep 30
538+ done
469539 rm -f /tmp/gpg-passphrase
470- dput "${{ vars.PPA_TARGET }}" try_*_source.changes
540+ [ -z "$failed" ] || { echo "failed uploads:$failed"; exit 1; }
471541
472542 prerelease :
473543 needs :
@@ -479,7 +549,7 @@ jobs:
479549 - trycase-check
480550 - package
481551 runs-on : ubuntu-latest
482- if : ${{ github.ref == 'refs/heads/main' }}
552+ if : ${{ github.ref == 'refs/heads/main' && github.event_name != 'schedule' }}
483553
484554 steps :
485555 - name : Download dist tarball
0 commit comments