Simplify workflow: drop generic packages, inline release creation
This commit is contained in:
+34
-51
@@ -27,17 +27,33 @@ jobs:
|
|||||||
--upload-file "${DEB}" \
|
--upload-file "${DEB}" \
|
||||||
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
||||||
|
|
||||||
- name: Upload to generic packages
|
- name: Create release and attach
|
||||||
run: |
|
run: |
|
||||||
|
TAG="${{ gitea.ref_name }}"
|
||||||
|
API="${{ gitea.server_url }}/api/v1"
|
||||||
|
REPO="${{ gitea.repository }}"
|
||||||
|
TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
||||||
DEB=$(ls build/*.deb)
|
DEB=$(ls build/*.deb)
|
||||||
FILENAME=$(basename "${DEB}")
|
FILENAME=$(basename "${DEB}")
|
||||||
curl --fail -X PUT \
|
|
||||||
-H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \
|
# Create release (ignore conflict if exists)
|
||||||
--upload-file "${DEB}" \
|
RELEASE_ID=$(curl -s -X POST \
|
||||||
"${{ gitea.server_url }}/api/packages/madcat-os/generic/madcat-caddy/${{ gitea.ref_name }}/${FILENAME}"
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
|
"${API}/repos/${REPO}/releases" | jq -r '.id')
|
||||||
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
|
# Attach amd64 deb
|
||||||
|
curl --fail -X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-F "attachment=@${DEB}" \
|
||||||
|
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
||||||
|
echo "Attached: ${FILENAME}"
|
||||||
|
|
||||||
build-arm64:
|
build-arm64:
|
||||||
runs-on: sin
|
runs-on: sin
|
||||||
|
needs: [build-amd64]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
@@ -57,57 +73,24 @@ jobs:
|
|||||||
--upload-file "${DEB}" \
|
--upload-file "${DEB}" \
|
||||||
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
||||||
|
|
||||||
- name: Upload to generic packages
|
- name: Attach to release
|
||||||
run: |
|
|
||||||
DEB=$(ls build/*.deb)
|
|
||||||
FILENAME=$(basename "${DEB}")
|
|
||||||
curl --fail -X PUT \
|
|
||||||
-H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \
|
|
||||||
--upload-file "${DEB}" \
|
|
||||||
"${{ gitea.server_url }}/api/packages/madcat-os/generic/madcat-caddy/${{ gitea.ref_name }}/${FILENAME}"
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: junkpile
|
|
||||||
needs: [build-amd64, build-arm64]
|
|
||||||
steps:
|
|
||||||
- name: Download artifacts
|
|
||||||
run: |
|
|
||||||
mkdir -p artifacts
|
|
||||||
TAG="${{ gitea.ref_name }}"
|
|
||||||
VERSION="${TAG#v}"
|
|
||||||
for arch in amd64 arm64; do
|
|
||||||
FILENAME="madcat-caddy_${VERSION}_${arch}.deb"
|
|
||||||
echo "Downloading ${FILENAME}..."
|
|
||||||
curl --fail -fsSL \
|
|
||||||
-H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \
|
|
||||||
-o "artifacts/${FILENAME}" \
|
|
||||||
"${{ gitea.server_url }}/api/packages/madcat-os/generic/madcat-caddy/${TAG}/${FILENAME}"
|
|
||||||
done
|
|
||||||
ls -la artifacts/
|
|
||||||
|
|
||||||
- name: Create release and attach assets
|
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
API="${{ gitea.server_url }}/api/v1"
|
API="${{ gitea.server_url }}/api/v1"
|
||||||
REPO="${{ gitea.repository }}"
|
REPO="${{ gitea.repository }}"
|
||||||
TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
||||||
|
DEB=$(ls build/*.deb)
|
||||||
|
FILENAME=$(basename "${DEB}")
|
||||||
|
|
||||||
# Create release
|
# Find existing release by tag
|
||||||
RELEASE_ID=$(curl --fail -X POST \
|
RELEASE_ID=$(curl -s \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
"${API}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id')
|
||||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" \
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
"${API}/repos/${REPO}/releases" | jq -r '.id')
|
|
||||||
echo "Created release ID: ${RELEASE_ID}"
|
|
||||||
|
|
||||||
# Attach .deb files
|
# Attach arm64 deb
|
||||||
for deb in artifacts/*.deb; do
|
curl --fail -X POST \
|
||||||
FILENAME=$(basename "${deb}")
|
-H "Authorization: token ${TOKEN}" \
|
||||||
echo "Attaching ${FILENAME}..."
|
-F "attachment=@${DEB}" \
|
||||||
curl --fail -X POST \
|
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
||||||
-H "Authorization: token ${TOKEN}" \
|
echo "Attached: ${FILENAME}"
|
||||||
-F "attachment=@${deb}" \
|
|
||||||
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
|
||||||
echo ""
|
|
||||||
done
|
|
||||||
echo "Release ${TAG} published with all assets."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user