Files
ntfy-bridge/.gitea/workflows/ci.yml
T
bruno b049b9ce2a
CI / build (push) Failing after 36s
ci: job unique — artifacts sur chaque push, release via API sur tag
Un seul job build qui:
1. Build 3 archs (linux amd64, linux arm64, windows amd64)
2. Lance les tests
3. Upload les binaires comme artifacts (dispo dans Actions > Summary)
4. Si tag v*: crée une release Gitea + attache les binaires (curl API)

Plus besoin de job release séparé — tout est dans build.
2026-08-05 21:26:21 -04:00

81 lines
2.9 KiB
YAML

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install V
run: |
git clone --depth 1 https://github.com/vlang/v /opt/v
cd /opt/v && make
ln -s /opt/v/v /usr/local/bin/v
- name: Build Linux x86_64
run: |
mkdir -p build
v -prod -os linux -arch amd64 -o build/ntfy-bridge-linux-x86_64 .
- name: Build Linux arm64 (Raspberry Pi)
run: v -prod -os linux -arch arm64 -o build/ntfy-bridge-linux-arm64 .
- name: Build Windows x86_64
run: v -prod -os windows -arch amd64 -o build/ntfy-bridge-windows-x86_64.exe .
- name: Test
run: v test .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaires
path: build/*
- name: Publish Release (tags only)
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/}
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
echo "==> Creating release ${VERSION}..."
# Supprimer release existante (idempotent)
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/tags/${VERSION}")
EXISTING_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if [ -n "$EXISTING_ID" ]; then
echo " Deleting existing release #${EXISTING_ID}..."
curl -sf -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/${EXISTING_ID}"
fi
# Creer la release
BODY="## ntfy-bridge ${VERSION}\n\nBinaires statiques — zero dependance.\n\n### Linux\n- \`ntfy-bridge-linux-x86_64\` (x86_64)\n- \`ntfy-bridge-linux-arm64\` (Raspberry Pi)\n\n### Windows\n- \`ntfy-bridge-windows-x86_64.exe\`"
RESP=$(curl -sf -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
"${API}/releases")
RELEASE_ID=$(echo "$RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo "Release ID: ${RELEASE_ID}"
# Uploader chaque binaire
for FILE in build/ntfy-bridge-*; do
[ -f "$FILE" ] || continue
FNAME=$(basename "$FILE")
echo " Uploading ${FNAME}..."
curl -sf -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${FILE}" \
"${API}/releases/${RELEASE_ID}/assets?name=${FNAME}"
done
echo "==> Release ${VERSION} complete!"