build: sign the release package and complete its metadata
This commit is contained in:
3 files changed
+94
-20
No files matched your search
@@ -23,6 +23,10 @@ jobs:
|
|||||||
runs-on: arch-host
|
runs-on: arch-host
|
||||||
env:
|
env:
|
||||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
# makepkg writes the keyring it imports into; the job keeps it out of the
|
||||||
|
# checkout and removes it with the runner's temporary directory.
|
||||||
|
GNUPGHOME: ${{ runner.temp }}/gnupg
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -37,6 +41,15 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Import the package signing key
|
||||||
|
if: env.GPG_PRIVATE_KEY != ''
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
mkdir -p "$GNUPGHOME"
|
||||||
|
chmod 700 "$GNUPGHOME"
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | base64 -d | gpg --batch --import
|
||||||
|
gpg --batch --list-secret-keys --keyid-format=long
|
||||||
|
|
||||||
- name: Build the Arch package
|
- name: Build the Arch package
|
||||||
id: package
|
id: package
|
||||||
run: |
|
run: |
|
||||||
@@ -51,57 +64,100 @@ jobs:
|
|||||||
# makepkg needs the PKGBUILD, the version file it reads and the source
|
# makepkg needs the PKGBUILD, the version file it reads and the source
|
||||||
# tarball in one directory; the runner's checkout stays untouched.
|
# tarball in one directory; the runner's checkout stays untouched.
|
||||||
cd "$work"
|
cd "$work"
|
||||||
makepkg --noconfirm --nodeps --force --cleanbuild
|
# The packager and the signing key live in makepkg's configuration, and
|
||||||
|
# makepkg has no command-line flag for either.
|
||||||
|
conf="$work/makepkg.conf"
|
||||||
|
cp /etc/makepkg.conf "$conf"
|
||||||
|
printf 'PACKAGER="%s"\n' 'BlackAngelTVdev <dami.scoot3@gmail.com>' >> "$conf"
|
||||||
|
sign=()
|
||||||
|
if gpg --batch --list-secret-keys 2>/dev/null | grep -q '^sec'; then
|
||||||
|
gpgkey="$(gpg --batch --with-colons --list-secret-keys \
|
||||||
|
| awk -F: '/^fpr:/{print $10; exit}')"
|
||||||
|
printf 'GPGKEY="%s"\n' "$gpgkey" >> "$conf"
|
||||||
|
sign=(--sign)
|
||||||
|
else
|
||||||
|
echo "::warning::no signing key available, releasing an unsigned package"
|
||||||
|
fi
|
||||||
|
makepkg --config "$conf" --noconfirm --nodeps --force --cleanbuild "${sign[@]}"
|
||||||
asset="$(ls -1 ./*.pkg.tar.zst | grep -v -- '-debug-' | head -1)"
|
asset="$(ls -1 ./*.pkg.tar.zst | grep -v -- '-debug-' | head -1)"
|
||||||
echo "file=$work/${asset##*/}" >> "$GITHUB_OUTPUT"
|
echo "file=$work/${asset##*/}" >> "$GITHUB_OUTPUT"
|
||||||
echo "name=${asset##*/}" >> "$GITHUB_OUTPUT"
|
echo "name=${asset##*/}" >> "$GITHUB_OUTPUT"
|
||||||
|
if [ -f "${asset}.sig" ]; then
|
||||||
|
echo "sig=$work/${asset##*/}.sig" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Create the release and attach the package
|
- name: Verify the signature
|
||||||
|
if: steps.package.outputs.sig != ''
|
||||||
|
env:
|
||||||
|
PACKAGE_FILE: ${{ steps.package.outputs.file }}
|
||||||
|
SIGNATURE: ${{ steps.package.outputs.sig }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
gpg --batch --verify "$SIGNATURE" "$PACKAGE_FILE"
|
||||||
|
|
||||||
|
- name: Create the release and attach the artefacts
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
PACKAGE_FILE: ${{ steps.package.outputs.file }}
|
||||||
|
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
||||||
|
SIGNATURE: ${{ steps.package.outputs.sig }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
||||||
version='${{ steps.version.outputs.version }}'
|
version='${{ steps.version.outputs.version }}'
|
||||||
tag="v$version"
|
tag="v$version"
|
||||||
name="${{ steps.package.outputs.name }}"
|
|
||||||
file="${{ steps.package.outputs.file }}"
|
|
||||||
auth="Authorization: token $GITEA_TOKEN"
|
auth="Authorization: token $GITEA_TOKEN"
|
||||||
|
|
||||||
release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | jq -r 'if type == "object" then (.id // empty) else empty end')"
|
release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | jq -r 'if type == "object" then (.id // empty) else empty end')"
|
||||||
if [ -z "$release_id" ]; then
|
if [ -z "$release_id" ]; then
|
||||||
body="FWS-DeskManager $version
|
body="FWS-DeskManager $version
|
||||||
|
|
||||||
Arch package: \`$name\`"
|
Arch package: \`$PACKAGE_NAME\`
|
||||||
|
Signature: \`$PACKAGE_NAME.sig\`, key \`fws-package-signing.asc\`
|
||||||
|
|
||||||
|
Verify the download with:
|
||||||
|
\`\`\`
|
||||||
|
gpg --verify $PACKAGE_NAME.sig $PACKAGE_NAME
|
||||||
|
\`\`\`"
|
||||||
release_id="$(curl -sS --fail-with-body -X POST -H "$auth" -H 'Content-Type: application/json' \
|
release_id="$(curl -sS --fail-with-body -X POST -H "$auth" -H 'Content-Type: application/json' \
|
||||||
-d "$(jq -n --arg tag "$tag" --arg name "FWS-DeskManager $version" \
|
-d "$(jq -n --arg tag "$tag" --arg name "FWS-DeskManager $version" \
|
||||||
--arg body "$body" '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
--arg body "$body" '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||||
"$api/releases" | jq -r '.id')"
|
"$api/releases" | jq -r '.id')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# A re-run must not fail on its own previous asset.
|
# A re-run must not fail on its own previous asset, so an asset with the
|
||||||
previous="$(curl -sS -H "$auth" "$api/releases/$release_id/assets" \
|
# same name is replaced rather than duplicated.
|
||||||
| jq -r --arg n "$name" '.[] | select(.name == $n) | .id')"
|
previous="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")"
|
||||||
if [ -n "$previous" ]; then
|
attach() {
|
||||||
curl -sS -X DELETE -H "$auth" "$api/releases/assets/$previous" -o /dev/null
|
local file="$1" name="$2" id
|
||||||
|
id="$(jq -r --arg n "$name" '.[] | select(.name == $n) | .id' <<<"$previous")"
|
||||||
|
if [ -n "$id" ]; then
|
||||||
|
curl -sS -X DELETE -H "$auth" "$api/releases/assets/$id" -o /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -sS --fail-with-body -X POST -H "$auth" \
|
curl -sS --fail-with-body -X POST -H "$auth" \
|
||||||
-F "attachment=@$file" \
|
-F "attachment=@$file" \
|
||||||
"$api/releases/$release_id/assets?name=$name" -o /dev/null
|
"$api/releases/$release_id/assets?name=$name" -o /dev/null
|
||||||
echo "attached $name to release $tag"
|
echo "attached $name"
|
||||||
|
}
|
||||||
|
|
||||||
|
attach "$PACKAGE_FILE" "$PACKAGE_NAME"
|
||||||
|
if [ -n "$SIGNATURE" ]; then
|
||||||
|
attach "$SIGNATURE" "$PACKAGE_NAME.sig"
|
||||||
|
attach packaging/fws-package-signing.asc fws-package-signing.asc
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Publish to repo.laxacube.ch
|
- name: Publish to repo.laxacube.ch
|
||||||
if: env.REPO_TOKEN != ''
|
if: env.REPO_TOKEN != ''
|
||||||
|
env:
|
||||||
|
PACKAGE_FILE: ${{ steps.package.outputs.file }}
|
||||||
|
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
file="${{ steps.package.outputs.file }}"
|
|
||||||
name="${{ steps.package.outputs.name }}"
|
|
||||||
curl -sS --fail-with-body -X POST https://repo.laxacube.ch/api/packages \
|
curl -sS --fail-with-body -X POST https://repo.laxacube.ch/api/packages \
|
||||||
-H "Authorization: Bearer $REPO_TOKEN" \
|
-H "Authorization: Bearer $REPO_TOKEN" \
|
||||||
-H "X-Filename: $name" \
|
-H "X-Filename: $PACKAGE_NAME" \
|
||||||
-H 'Content-Type: application/octet-stream' \
|
-H 'Content-Type: application/octet-stream' \
|
||||||
--data-binary "@$file"
|
--data-binary "@$PACKAGE_FILE"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- name: Warn when the upload token is missing
|
- name: Warn when the upload token is missing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Maintainer: FWS
|
# Maintainer: BlackAngelTVdev <dami.scoot3@gmail.com>
|
||||||
# The version file is the single source of truth for releases, so the package
|
# The version file is the single source of truth for releases, so the package
|
||||||
# version follows it instead of being duplicated here.
|
# version follows it instead of being duplicated here.
|
||||||
#
|
#
|
||||||
@@ -8,15 +8,24 @@
|
|||||||
pkgname=fws-deskmanager
|
pkgname=fws-deskmanager
|
||||||
pkgver=$(tr -d '[:space:]' < version)
|
pkgver=$(tr -d '[:space:]' < version)
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Switch desktop environments on Arch Linux without rebooting"
|
pkgdesc="Switch between installed desktop sessions without rebooting"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="https://gitea.nocode-var.tech/FWS/FWS-DeskManger"
|
url="https://gitea.nocode-var.tech/FWS/FWS-DeskManger"
|
||||||
license=('unknown')
|
license=('GPL-3.0-or-later')
|
||||||
depends=('gtk4' 'systemd' 'polkit')
|
# loginctl, systemctl and pacman come from packages every Arch install already
|
||||||
|
# has; only the toolkit and the polkit helper are real additions.
|
||||||
|
depends=('gtk4' 'polkit')
|
||||||
|
optdepends=(
|
||||||
|
'sddm: display manager for the login screen and the one-off autologin'
|
||||||
|
'gdm: display manager for the login screen'
|
||||||
|
'lightdm: display manager for the login screen, needs dm-tool'
|
||||||
|
)
|
||||||
makedepends=('cmake' 'pkgconf')
|
makedepends=('cmake' 'pkgconf')
|
||||||
# Release packages only: the debug split package has no use for end users.
|
# Release packages only: the debug split package has no use for end users.
|
||||||
options=('!debug')
|
options=('!debug')
|
||||||
source=("$pkgname-$pkgver.tar.gz")
|
source=("$pkgname-$pkgver.tar.gz")
|
||||||
|
# The tarball is produced from the commit being packaged, so there is no
|
||||||
|
# published checksum to pin here.
|
||||||
sha256sums=('SKIP')
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mDMEawAB3hYJKwYBBAHaRw8BAQdAFe/ubNzQiCNE+s8m9L9hE2sL4RQDFSxvsmJV
|
||||||
|
bEkNGwy0J0ZXUyBQYWNrYWdlcyAoQXJjaCBwYWNrYWdlIHNpZ25pbmcga2V5KYiQ
|
||||||
|
BBMWCgA4FiEEyHUfq4EPLOrc78rY5rPJ3q89U4sFAmsAAd4CGwMFCwkIBwIGFQoJ
|
||||||
|
CAsCBBYCAwECHgECF4AACgkQ5rPJ3q89U4sZjwEAmf5pq9/RIgeuESztQbpS4YCc
|
||||||
|
DSFqgqFdfFmyicZVnzIA/j4ztCyJR+l4iy2QV/C0vaPploQNIstsCHUidnw/gpML
|
||||||
|
=XJmF
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
Reference in new issue
Block a user