This commit is contained in:
3 files changed
+33
-21
No files matched your search
@@ -129,6 +129,29 @@ jobs:
|
|||||||
tag="v$VERSION"
|
tag="v$VERSION"
|
||||||
auth="Authorization: token $RELEASE_TOKEN"
|
auth="Authorization: token $RELEASE_TOKEN"
|
||||||
|
|
||||||
|
# A pacman version is immutable: the repository index, the CDN in
|
||||||
|
# front of it and every client cache the package by its name, so a
|
||||||
|
# second build published under the same name leaves them disagreeing
|
||||||
|
# and pacman reports the download as corrupted. Once repo.laxacube.ch
|
||||||
|
# serves the name there is nothing left to publish: a re-run is a
|
||||||
|
# no-op, and a changed build needs a pkgrel bump so it gets its own
|
||||||
|
# package name.
|
||||||
|
local_sha256="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
||||||
|
repo_sha256=""
|
||||||
|
if curl -fsSL "https://repo.laxacube.ch/x86_64/$PACKAGE_NAME" -o "$RUNNER_TEMP/repo.pkg" 2>/dev/null; then
|
||||||
|
repo_sha256="$(sha256sum "$RUNNER_TEMP/repo.pkg" | cut -d' ' -f1)"
|
||||||
|
fi
|
||||||
|
if [ -n "$repo_sha256" ]; then
|
||||||
|
if [ "$repo_sha256" = "$local_sha256" ]; then
|
||||||
|
echo "$PACKAGE_NAME is already published to repo.laxacube.ch, nothing to do"
|
||||||
|
else
|
||||||
|
echo "::warning::$PACKAGE_NAME is already published to repo.laxacube.ch with sha256 $repo_sha256, this build is $local_sha256 and is not published"
|
||||||
|
echo "::warning::bump pkgrel in packaging/PKGBUILD to publish this build under its own package name"
|
||||||
|
fi
|
||||||
|
echo "SKIP_PUBLISH=1" >> "$GITHUB_ENV"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | python3 -c '
|
release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | python3 -c '
|
||||||
import json, sys
|
import json, sys
|
||||||
try:
|
try:
|
||||||
@@ -154,23 +177,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "release_id=$release_id"
|
echo "release_id=$release_id"
|
||||||
|
|
||||||
# A pacman version is immutable: clients cache the package by name and
|
|
||||||
# repo.laxacube.ch serves it through a CDN, so a rebuild published
|
|
||||||
# under the same version leaves those caches holding bytes the index
|
|
||||||
# no longer matches, and pacman reports the file as corrupted. A
|
|
||||||
# re-run that rebuilds identical bytes stays allowed.
|
|
||||||
local_sha256="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
|
||||||
published_sha256=""
|
|
||||||
sha_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$tag/$PACKAGE_NAME.sha256"
|
|
||||||
if curl -fsSL "$sha_url" -o "$RUNNER_TEMP/published.sha256"; then
|
|
||||||
published_sha256="$(cut -d' ' -f1 "$RUNNER_TEMP/published.sha256")"
|
|
||||||
fi
|
|
||||||
if [ -n "$published_sha256" ] && [ "$published_sha256" != "$local_sha256" ]; then
|
|
||||||
echo "::error::$PACKAGE_NAME is already published with sha256 $published_sha256 but this build is $local_sha256"
|
|
||||||
echo "::error::bump pkgrel in packaging/PKGBUILD so the rebuild is published as its own version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# A re-run must replace its own artefacts instead of failing on them.
|
# A re-run must replace its own artefacts instead of failing on them.
|
||||||
assets="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")"
|
assets="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")"
|
||||||
attach() {
|
attach() {
|
||||||
@@ -195,6 +201,9 @@ jobs:
|
|||||||
attach "$PACKAGE_FILE.sha256" "$PACKAGE_NAME.sha256"
|
attach "$PACKAGE_FILE.sha256" "$PACKAGE_NAME.sha256"
|
||||||
|
|
||||||
- name: Push the package to repo.laxacube.ch
|
- name: Push the package to repo.laxacube.ch
|
||||||
|
# Skipped when the release step found the version already published, so
|
||||||
|
# a re-run can never replace the bytes pacman clients are served.
|
||||||
|
if: env.SKIP_PUBLISH != '1'
|
||||||
env:
|
env:
|
||||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||||
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
||||||
|
|||||||
@@ -321,9 +321,10 @@ Pour reconstruire la même version du fork (correctif de packaging), incrémente
|
|||||||
`pkgrel` dans `packaging/PKGBUILD` puis lancez le workflow à la main
|
`pkgrel` dans `packaging/PKGBUILD` puis lancez le workflow à la main
|
||||||
(*Actions → Release → Run workflow*) : le paquet `0.1.7-2` remplace alors le
|
(*Actions → Release → Run workflow*) : le paquet `0.1.7-2` remplace alors le
|
||||||
`0.1.7-1`. Une version déjà publiée n'est jamais réécrite avec un autre build :
|
`0.1.7-1`. Une version déjà publiée n'est jamais réécrite avec un autre build :
|
||||||
le workflow refuse de remplacer un paquet dont l'empreinte a changé et demande
|
si `repo.laxacube.ch` sert déjà ce nom de paquet, le workflow s'arrête sans
|
||||||
d'incrémenter `pkgrel`, sinon les caches (CDN, pacman) servent un fichier qui ne
|
republier (relancer une release est donc sans effet et ne fait pas échouer la
|
||||||
correspond plus à la base. Une nouvelle version du fork demande `version`,
|
CI) ; pour publier un build différent, incrémentez `pkgrel`, sinon les caches
|
||||||
|
(CDN, pacman) servent un fichier qui ne correspond plus à la base. Une nouvelle version du fork demande `version`,
|
||||||
`pkgver` et les deux front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre
|
`pkgver` et les deux front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre
|
||||||
à jour `_kittyver` et `kitty/constants.py`. La publication vers
|
à jour `_kittyver` et `kitty/constants.py`. La publication vers
|
||||||
`repo.laxacube.ch` utilise le
|
`repo.laxacube.ch` utilise le
|
||||||
|
|||||||
+3
-1
@@ -95,7 +95,9 @@ Une version publiée n'est jamais réécrite : deux builds du même commit ne so
|
|||||||
pas identiques à l'octet près, et le CDN comme le cache pacman gardent le fichier
|
pas identiques à l'octet près, et le CDN comme le cache pacman gardent le fichier
|
||||||
sous son nom, donc republier `0.1.7-1` avec un autre contenu donne des caches qui
|
sous son nom, donc republier `0.1.7-1` avec un autre contenu donne des caches qui
|
||||||
désaccordent avec la base et pacman rejette le téléchargement (`paquet non valide
|
désaccordent avec la base et pacman rejette le téléchargement (`paquet non valide
|
||||||
ou corrompu`). Le workflow refuse ce cas et demande d'incrémenter `pkgrel`.
|
ou corrompu`). Le workflow s'arrête donc sans republier quand le dépôt sert déjà
|
||||||
|
ce nom de paquet (relancer une release est sans effet), et demande d'incrémenter
|
||||||
|
`pkgrel` pour publier un build différent.
|
||||||
Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du
|
Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du
|
||||||
build, pour ne pas annoncer une publication que les clients ne peuvent pas
|
build, pour ne pas annoncer une publication que les clients ne peuvent pas
|
||||||
installer.
|
installer.
|
||||||
|
|||||||
Reference in new issue
Block a user