This commit is contained in:
@@ -114,9 +114,14 @@ jobs:
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
DEB="fenris_${VERSION}_amd64.deb"
|
||||
for CODENAME in bookworm jammy noble; do
|
||||
curl --fail --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||
-T "dist/${DEB}" \
|
||||
"https://git.bongbetic.com/api/packages/xavierk/debian/pool/${CODENAME}/main/upload"
|
||||
STATUS=$(curl --silent --show-error --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||
-T "dist/${DEB}" -o /dev/null -w '%{http_code}' \
|
||||
"https://git.bongbetic.com/api/packages/xavierk/debian/pool/${CODENAME}/main/upload" || true)
|
||||
case "${STATUS}" in
|
||||
200|201|204) echo "Debian ${CODENAME}: uploaded" ;;
|
||||
409) echo "Debian ${CODENAME}: already exists, kept existing package" ;;
|
||||
*) echo "::error::Debian ${CODENAME} upload failed with HTTP ${STATUS}"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
- name: Upload RPM to registry
|
||||
@@ -126,9 +131,14 @@ jobs:
|
||||
set -euo pipefail
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
RPM="fenris-${VERSION}-1.x86_64.rpm"
|
||||
curl --fail --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||
-T "dist/${RPM}" \
|
||||
"https://git.bongbetic.com/api/packages/xavierk/rpm/fenris/upload"
|
||||
STATUS=$(curl --silent --show-error --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||
-T "dist/${RPM}" -o /dev/null -w '%{http_code}' \
|
||||
"https://git.bongbetic.com/api/packages/xavierk/rpm/fenris/upload" || true)
|
||||
case "${STATUS}" in
|
||||
200|201|204) echo "RPM: uploaded" ;;
|
||||
409) echo "RPM: already exists, kept existing package" ;;
|
||||
*) echo "::error::RPM upload failed with HTTP ${STATUS}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
- name: Create Gitea release
|
||||
env:
|
||||
@@ -153,18 +163,25 @@ jobs:
|
||||
env:
|
||||
GITEA_PUBLISH_TOKEN: ${{ secrets.GITEAPACKAGETOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
# Get release ID for this tag
|
||||
RELEASE_ID=$(curl -s \
|
||||
RELEASE_JSON=$(curl --fail --silent --show-error \
|
||||
-H "Authorization: token ${GITEA_PUBLISH_TOKEN}" \
|
||||
"https://git.bongbetic.com/api/v1/repos/xavierk/Fenris/releases/tags/v${VERSION}" \
|
||||
"https://git.bongbetic.com/api/v1/repos/xavierk/Fenris/releases/tags/v${VERSION}")
|
||||
RELEASE_ID=$(printf '%s' "${RELEASE_JSON}" \
|
||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||
# Attach deb, rpm, and clearsigned checksums
|
||||
# Attach deb, rpm, and clearsigned checksums once.
|
||||
for FILE in "dist/fenris_${VERSION}_amd64.deb" \
|
||||
"dist/fenris-${VERSION}-1.x86_64.rpm" \
|
||||
"dist/SHA256SUMS.asc"; do
|
||||
curl --fail -X POST \
|
||||
ASSET_NAME="${FILE##*/}"
|
||||
if python3 -c 'import json,sys; name=sys.argv[1]; sys.exit(0 if any(a.get("name") == name for a in json.load(sys.stdin).get("assets", [])) else 1)' "${ASSET_NAME}" <<<"${RELEASE_JSON}"; then
|
||||
echo "${ASSET_NAME}: already attached"
|
||||
else
|
||||
curl --fail --silent --show-error -X POST \
|
||||
-H "Authorization: token ${GITEA_PUBLISH_TOKEN}" \
|
||||
-F "attachment=@${FILE}" \
|
||||
"https://git.bongbetic.com/api/v1/repos/xavierk/Fenris/releases/${RELEASE_ID}/assets"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user