Files
madcat-caddy/.gitea/workflows/build.yml
T
marauder-actual 5729d0e5ae
Build and Release / build-arm64 (push) Has been cancelled
Build and Release / build-amd64 (push) Failing after 12m40s
Simplify workflow: drop generic packages, inline release creation
2026-06-12 17:47:26 +02:00

97 lines
3.1 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build-amd64:
runs-on: junkpile
steps:
- name: Checkout
run: |
git init
git remote add origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
git fetch --depth=1 origin ${{ gitea.ref }}
git checkout FETCH_HEAD
- name: Build .deb
run: make deb
- name: Publish to apt registry
run: |
DEB=$(ls build/*.deb)
echo "Publishing ${DEB}..."
curl --fail -H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \
--upload-file "${DEB}" \
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
- 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}")
# 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: |
git init
git remote add origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
git fetch --depth=1 origin ${{ gitea.ref }}
git checkout FETCH_HEAD
- name: Build .deb
run: make deb
- name: Publish to apt registry
run: |
DEB=$(ls build/*.deb)
echo "Publishing ${DEB}..."
curl --fail -H "Authorization: token ${{ secrets.PACKAGES_TOKEN }}" \
--upload-file "${DEB}" \
"${{ gitea.server_url }}/api/packages/madcat-os/debian/pool/bookworm/main/upload"
- 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}")
# Find existing release by tag
RELEASE_ID=$(curl -s \
-H "Authorization: token ${TOKEN}" \
"${API}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id')
echo "Release ID: ${RELEASE_ID}"
# Attach arm64 deb
curl --fail -X POST \
-H "Authorization: token ${TOKEN}" \
-F "attachment=@${DEB}" \
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
echo "Attached: ${FILENAME}"