Simplify workflow: drop generic packages, inline release creation
This commit is contained in:
+31
-48
@@ -27,17 +27,33 @@ jobs:
|
||||
--upload-file "${DEB}" \
|
||||
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
||||
|
||||
- name: Upload to generic packages
|
||||
- name: Create release and attach
|
||||
run: |
|
||||
TAG="${{ gitea.ref_name }}"
|
||||
API="${{ gitea.server_url }}/api/v1"
|
||||
REPO="${{ gitea.repository }}"
|
||||
TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
||||
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}"
|
||||
|
||||
# Create release (ignore conflict if exists)
|
||||
RELEASE_ID=$(curl -s -X POST \
|
||||
-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:
|
||||
runs-on: sin
|
||||
needs: [build-amd64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
@@ -57,57 +73,24 @@ jobs:
|
||||
--upload-file "${DEB}" \
|
||||
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
|
||||
|
||||
- name: Upload to generic packages
|
||||
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
|
||||
- name: Attach to release
|
||||
run: |
|
||||
TAG="${{ gitea.ref_name }}"
|
||||
API="${{ gitea.server_url }}/api/v1"
|
||||
REPO="${{ gitea.repository }}"
|
||||
TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
||||
DEB=$(ls build/*.deb)
|
||||
FILENAME=$(basename "${DEB}")
|
||||
|
||||
# Create release
|
||||
RELEASE_ID=$(curl --fail -X POST \
|
||||
# Find existing release by tag
|
||||
RELEASE_ID=$(curl -s \
|
||||
-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 "Created release ID: ${RELEASE_ID}"
|
||||
"${API}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id')
|
||||
echo "Release ID: ${RELEASE_ID}"
|
||||
|
||||
# Attach .deb files
|
||||
for deb in artifacts/*.deb; do
|
||||
FILENAME=$(basename "${deb}")
|
||||
echo "Attaching ${FILENAME}..."
|
||||
# Attach arm64 deb
|
||||
curl --fail -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-F "attachment=@${deb}" \
|
||||
-F "attachment=@${DEB}" \
|
||||
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
||||
echo ""
|
||||
done
|
||||
echo "Release ${TAG} published with all assets."
|
||||
echo "Attached: ${FILENAME}"
|
||||
|
||||
Reference in New Issue
Block a user