ci: job unique — artifacts sur chaque push, release via API sur tag
CI / build (push) Failing after 36s
CI / build (push) Failing after 36s
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.
This commit is contained in:
+15
-35
@@ -34,67 +34,47 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: v test .
|
run: v test .
|
||||||
|
|
||||||
- name: Verify version
|
|
||||||
run: |
|
|
||||||
./build/ntfy-bridge-linux-x86_64 --version
|
|
||||||
./build/ntfy-bridge-linux-x86_64 --help
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ntfy-bridge-binaires
|
name: binaires
|
||||||
path: |
|
path: build/*
|
||||||
build/ntfy-bridge-linux-x86_64
|
|
||||||
build/ntfy-bridge-linux-arm64
|
|
||||||
build/ntfy-bridge-windows-x86_64.exe
|
|
||||||
|
|
||||||
release:
|
- name: Publish Release (tags only)
|
||||||
runs-on: ubuntu-latest
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ntfy-bridge-binaires
|
|
||||||
path: build
|
|
||||||
|
|
||||||
- name: Publish Gitea Release
|
|
||||||
run: |
|
run: |
|
||||||
VERSION=${GITHUB_REF#refs/tags/}
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||||
echo "==> Creating release ${VERSION}..."
|
echo "==> Creating release ${VERSION}..."
|
||||||
chmod +x build/* 2>/dev/null || true
|
|
||||||
|
|
||||||
# Supprimer release existante (idempotent)
|
# Supprimer release existante (idempotent)
|
||||||
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/tags/${VERSION}")
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${VERSION}")
|
|
||||||
EXISTING_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
EXISTING_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
if [ -n "$EXISTING_ID" ]; then
|
if [ -n "$EXISTING_ID" ]; then
|
||||||
echo " Deleting existing release #${EXISTING_ID}..."
|
echo " Deleting existing release #${EXISTING_ID}..."
|
||||||
curl -s -f -X DELETE \
|
curl -sf -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${API}/releases/${EXISTING_ID}"
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${EXISTING_ID}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Creer la release
|
# Creer la release
|
||||||
RELEASE_RESP=$(curl -s -f -X POST \
|
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 "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"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\`\n\n### Installation\n\`\`\`bash\nchmod +x ntfy-bridge-linux-x86_64\nsudo mv ntfy-bridge-linux-x86_64 /usr/local/bin/ntfy-bridge\nntfy-bridge --install-service\n\`\`\`\",\"draft\":false,\"prerelease\":false}" \
|
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases")
|
"${API}/releases")
|
||||||
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
RELEASE_ID=$(echo "$RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
echo "Release ID: ${RELEASE_ID}"
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
# Uploader les binaires
|
# Uploader chaque binaire
|
||||||
for FILE in build/ntfy-bridge-*; do
|
for FILE in build/ntfy-bridge-*; do
|
||||||
[ -f "$FILE" ] || continue
|
[ -f "$FILE" ] || continue
|
||||||
FNAME=$(basename "$FILE")
|
FNAME=$(basename "$FILE")
|
||||||
echo " Uploading ${FNAME}..."
|
echo " Uploading ${FNAME}..."
|
||||||
curl -s -f -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@${FILE}" \
|
--data-binary "@${FILE}" \
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FNAME}"
|
"${API}/releases/${RELEASE_ID}/assets?name=${FNAME}"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "==> Release ${VERSION} complete!"
|
echo "==> Release ${VERSION} complete!"
|
||||||
|
|||||||
Reference in New Issue
Block a user