Compare commits
3
Commits
b5951fac0b
..
v0.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01217ef040
|
||
|
|
d921e38baa
|
||
|
|
ff10e8bbd2
|
No files matched your search
@@ -0,0 +1,109 @@
|
|||||||
|
name: package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
# Only a version change produces a release; other commits stay off this path.
|
||||||
|
paths: [version]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
# Releases are ordered: a second run waits instead of racing for the same tag.
|
||||||
|
concurrency:
|
||||||
|
group: package
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
package:
|
||||||
|
# Arch containers cannot be stored on the NTFS runner disk: pacman's local
|
||||||
|
# database uses ':' in epoch directory names, which NTFS rejects. The package
|
||||||
|
# is therefore built by makepkg on the Arch host itself.
|
||||||
|
runs-on: arch-host
|
||||||
|
env:
|
||||||
|
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Read the version file
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
version="$(tr -d '[:space:]' < version)"
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "::error file=version::the version file is empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Build the Arch package
|
||||||
|
id: package
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
version='${{ steps.version.outputs.version }}'
|
||||||
|
work="$RUNNER_TEMP/build"
|
||||||
|
rm -rf "$work"
|
||||||
|
mkdir -p "$work"
|
||||||
|
cp PKGBUILD version "$work/"
|
||||||
|
git archive --format=tar.gz --prefix="fws-deskmanager-$version/" \
|
||||||
|
-o "$work/fws-deskmanager-$version.tar.gz" HEAD
|
||||||
|
# makepkg needs the PKGBUILD, the version file it reads and the source
|
||||||
|
# tarball in one directory; the runner's checkout stays untouched.
|
||||||
|
cd "$work"
|
||||||
|
makepkg --noconfirm --nodeps --force --cleanbuild
|
||||||
|
asset="$(ls -1 ./*.pkg.tar.zst | grep -v -- '-debug-' | head -1)"
|
||||||
|
echo "file=$work/${asset##*/}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "name=${asset##*/}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create the release and attach the package
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
||||||
|
version='${{ steps.version.outputs.version }}'
|
||||||
|
tag="v$version"
|
||||||
|
name="${{ steps.package.outputs.name }}"
|
||||||
|
file="${{ steps.package.outputs.file }}"
|
||||||
|
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')"
|
||||||
|
if [ -z "$release_id" ]; then
|
||||||
|
body="FWS-DeskManager $version
|
||||||
|
|
||||||
|
Arch package: \`$name\`"
|
||||||
|
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" \
|
||||||
|
--arg body "$body" '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||||
|
"$api/releases" | jq -r '.id')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A re-run must not fail on its own previous asset.
|
||||||
|
previous="$(curl -sS -H "$auth" "$api/releases/$release_id/assets" \
|
||||||
|
| jq -r --arg n "$name" '.[] | select(.name == $n) | .id')"
|
||||||
|
if [ -n "$previous" ]; then
|
||||||
|
curl -sS -X DELETE -H "$auth" "$api/releases/assets/$previous" -o /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -sS --fail-with-body -X POST -H "$auth" \
|
||||||
|
-F "attachment=@$file" \
|
||||||
|
"$api/releases/$release_id/assets?name=$name" -o /dev/null
|
||||||
|
echo "attached $name to release $tag"
|
||||||
|
|
||||||
|
- name: Publish to repo.laxacube.ch
|
||||||
|
if: env.REPO_TOKEN != ''
|
||||||
|
run: |
|
||||||
|
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 \
|
||||||
|
-H "Authorization: Bearer $REPO_TOKEN" \
|
||||||
|
-H "X-Filename: $name" \
|
||||||
|
-H 'Content-Type: application/octet-stream' \
|
||||||
|
--data-binary "@$file"
|
||||||
|
echo
|
||||||
|
|
||||||
|
- name: Warn when the upload token is missing
|
||||||
|
if: env.REPO_TOKEN == ''
|
||||||
|
run: echo "::warning::REPO_TOKEN is not set, the package was released but not published to repo.laxacube.ch"
|
||||||
@@ -36,3 +36,7 @@
|
|||||||
# Build directories
|
# Build directories
|
||||||
build/
|
build/
|
||||||
build-*/
|
build-*/
|
||||||
|
|
||||||
|
# ---> makepkg
|
||||||
|
pkg/
|
||||||
|
*.pkg.tar.*
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Maintainer: FWS
|
||||||
|
# The version file is the single source of truth for releases, so the package
|
||||||
|
# version follows it instead of being duplicated here.
|
||||||
|
pkgname=fws-deskmanager
|
||||||
|
pkgver=$(tr -d '[:space:]' < version)
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Switch desktop environments on Arch Linux without rebooting"
|
||||||
|
arch=('x86_64')
|
||||||
|
url="https://gitea.nocode-var.tech/FWS/FWS-DeskManger"
|
||||||
|
license=('unknown')
|
||||||
|
depends=('gtk4' 'systemd' 'polkit')
|
||||||
|
makedepends=('cmake' 'pkgconf')
|
||||||
|
# Release packages only: the debug split package has no use for end users.
|
||||||
|
options=('!debug')
|
||||||
|
source=("$pkgname-$pkgver.tar.gz")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cmake -S "$pkgname-$pkgver" -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
|
cmake --build build -j"$(nproc)"
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
DESTDIR="$pkgdir" cmake --install build
|
||||||
|
}
|
||||||
Reference in new issue
Block a user