This commit is contained in:
@@ -114,9 +114,14 @@ jobs:
|
|||||||
VERSION=${{ steps.version.outputs.version }}
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
DEB="fenris_${VERSION}_amd64.deb"
|
DEB="fenris_${VERSION}_amd64.deb"
|
||||||
for CODENAME in bookworm jammy noble; do
|
for CODENAME in bookworm jammy noble; do
|
||||||
curl --fail --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
STATUS=$(curl --silent --show-error --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||||
-T "dist/${DEB}" \
|
-T "dist/${DEB}" -o /dev/null -w '%{http_code}' \
|
||||||
"https://git.bongbetic.com/api/packages/xavierk/debian/pool/${CODENAME}/main/upload"
|
"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
|
done
|
||||||
|
|
||||||
- name: Upload RPM to registry
|
- name: Upload RPM to registry
|
||||||
@@ -126,9 +131,14 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
RPM="fenris-${VERSION}-1.x86_64.rpm"
|
RPM="fenris-${VERSION}-1.x86_64.rpm"
|
||||||
curl --fail --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
STATUS=$(curl --silent --show-error --user "xavierk:${GITEA_PUBLISH_TOKEN}" -X PUT \
|
||||||
-T "dist/${RPM}" \
|
-T "dist/${RPM}" -o /dev/null -w '%{http_code}' \
|
||||||
"https://git.bongbetic.com/api/packages/xavierk/rpm/fenris/upload"
|
"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
|
- name: Create Gitea release
|
||||||
env:
|
env:
|
||||||
@@ -153,18 +163,25 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_PUBLISH_TOKEN: ${{ secrets.GITEAPACKAGETOKEN }}
|
GITEA_PUBLISH_TOKEN: ${{ secrets.GITEAPACKAGETOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
# Get release ID for this tag
|
# Get release ID for this tag
|
||||||
RELEASE_ID=$(curl -s \
|
RELEASE_JSON=$(curl --fail --silent --show-error \
|
||||||
-H "Authorization: token ${GITEA_PUBLISH_TOKEN}" \
|
-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'])")
|
| 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" \
|
for FILE in "dist/fenris_${VERSION}_amd64.deb" \
|
||||||
"dist/fenris-${VERSION}-1.x86_64.rpm" \
|
"dist/fenris-${VERSION}-1.x86_64.rpm" \
|
||||||
"dist/SHA256SUMS.asc"; do
|
"dist/SHA256SUMS.asc"; do
|
||||||
curl --fail -X POST \
|
ASSET_NAME="${FILE##*/}"
|
||||||
-H "Authorization: token ${GITEA_PUBLISH_TOKEN}" \
|
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
|
||||||
-F "attachment=@${FILE}" \
|
echo "${ASSET_NAME}: already attached"
|
||||||
"https://git.bongbetic.com/api/v1/repos/xavierk/Fenris/releases/${RELEASE_ID}/assets"
|
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
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user