On main: cline checkpoint session=1789059923966_jj6g7 run=7

This commit is contained in:
git stash committed 2026-09-10 21:15:54 +02:00
commit f508a970f5
11 files changed
+700 -112

No files matched your search

+62 -1
View File
@@ -4,6 +4,12 @@
# Creates a Gitea release tagged with the new version — but ONLY if the
# version in `version` differs from the latest released tag.
#
# The release also uploads a prebuilt binary archive
# (PacManager-<version>-x86_64.tar.gz with the binary, version file and
# plugins) so installed apps can self-update WITHOUT recompiling: the
# UpdateManager prefers this asset over the source tarball. Falls back to
# the source tarball when the build fails, so a release is never blocked.
#
# No secret is required: `secrets.GITEA_TOKEN` is the built-in automatic
# token provided by Gitea on every run. The `permissions: contents: write`
# block below asks for write access to contents and releases, so the release
@@ -56,6 +62,7 @@ jobs:
- name: Create release
if: steps.check.outputs.new == 'true'
id: create
env:
# Built-in automatic token, no secret to configure. The
# `permissions` block at the top grants it write access to
@@ -69,7 +76,7 @@ jobs:
`version` file was bumped.
EOF
)
curl -sS -X POST "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases" \
RESP=$(curl -sS -X POST "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d @- <<JSON
@@ -80,3 +87,57 @@ jobs:
"body": "${BODY}"
}
JSON
)
echo "${RESP}"
ID=$(echo "${RESP}" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2)
echo "release_id=${ID}" >> "$GITHUB_OUTPUT"
- name: Build prebuilt binary archive
if: steps.check.outputs.new == 'true'
id: build
run: |
VERSION="${{ steps.version.outputs.value }}"
if command -v pacman >/dev/null 2>&1; then
sudo pacman -S --noconfirm --needed git cmake gcc make qt6-base
elif command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y git cmake g++ make qt6-base-dev
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y git cmake gcc-c++ make qt6-qtbase-devel
else
echo "Unsupported package manager — skipping prebuilt archive"
echo "ok=false" >> "$GITHUB_OUTPUT"
exit 0
fi
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
STAGE="pacmanager-dist"
rm -rf "${STAGE}" && mkdir -p "${STAGE}/bin" "${STAGE}/plugins"
cp build/PacManager "${STAGE}/bin/"
cp version "${STAGE}/bin/"
if ls build/plugins/*.so >/dev/null 2>&1; then
cp build/plugins/*.so "${STAGE}/plugins/"
fi
# Ship both bin/plugins (first search path) and lib layout inside
# the prebuilt archive so the self-update unpack works anywhere.
ARCHIVE="PacManager-${VERSION}-x86_64.tar.gz"
tar czf "${ARCHIVE}" -C "${STAGE}" bin plugins
echo "archive=${ARCHIVE}" >> "$GITHUB_OUTPUT"
echo "ok=true" >> "$GITHUB_OUTPUT"
- name: Upload prebuilt archive to release
if: steps.check.outputs.new == 'true' && steps.build.outputs.ok == 'true'
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
ARCHIVE="${{ steps.build.outputs.archive }}"
RELEASE_ID="${{ steps.create.outputs.release_id }}"
if [ -z "${RELEASE_ID}" ]; then
echo "No release id — skipping upload"
exit 0
fi
curl -sS -X POST \
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/${RELEASE_ID}/assets?name=$(basename ${ARCHIVE})" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/gzip" \
--data-binary "@${ARCHIVE}" || echo "Asset upload failed — release still valid without prebuilt binary"
+30 -1
View File
@@ -2,7 +2,9 @@
#
# Dedicated test workflow: builds the application and runs the full test suite
# (ctest) on every push and pull request. Kept separate from the release
# workflow so a failing test never blocks a release.
# workflow so a failing test never blocks a release. Also guards the
# `version` file: it must match the latest git tag (if any), otherwise the
# self-update check would report a phantom update.
name: tests
@@ -12,6 +14,33 @@ on:
workflow_dispatch:
jobs:
version-guard:
runs-on: linux
steps:
- name: Checkout with full history and tags
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Check version file matches latest tag (when tags exist)
run: |
VERSION=$(tr -d ' \n' < version)
echo "version file: ${VERSION}"
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || true)
if [ -z "${LATEST}" ]; then
echo "No tags yet — skipping version guard"
exit 0
fi
# Tags are like v1.3.1 / V1.3.1 ; the file holds 1.3.1
NORMALIZED=$(echo "${LATEST}" | sed -E 's/^[vV]//')
echo "latest tag: ${LATEST} (normalized: ${NORMALIZED})"
if [ "${VERSION}" != "${NORMALIZED}" ]; then
echo "::error::version file (${VERSION}) does not match latest tag ${LATEST} (expected ${NORMALIZED}). Bump the version file before tagging."
exit 1
fi
echo "version file matches latest tag"
build-test:
runs-on: linux
steps: