On main: cline checkpoint session=1789145782869_xv3bv run=1
This commit is contained in:
commit
253dd21464
11 files changed
+700
-112
No files matched your search
@@ -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"
|
||||
Reference in new issue
Block a user