ci: split en deux workflows — CI (push main) + Release (tags v*)
CI / test (push) Successful in 2m50s
CI / test (push) Successful in 2m50s
- ci.yml: build + test sur chaque push/PR (lightweight) - release.yml: cross-compile linux/x86_64, linux/arm64, windows/x86_64 puis crée une release Gitea avec curl + API (idempotent, re-run safe)
This commit is contained in:
@@ -3,7 +3,6 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
tags: ['v*']
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
@@ -30,52 +29,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
./ntfy-bridge --version
|
./ntfy-bridge --version
|
||||||
./ntfy-bridge --help
|
./ntfy-bridge --help
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
needs: test
|
|
||||||
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: 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: Create Gitea Release
|
|
||||||
uses: https://gitea.com/actions/release-action@v1
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
build/ntfy-bridge-linux-x86_64
|
|
||||||
build/ntfy-bridge-linux-arm64
|
|
||||||
build/ntfy-bridge-windows-x86_64.exe
|
|
||||||
body: |
|
|
||||||
## ntfy-bridge ${GITHUB_REF##*/}
|
|
||||||
|
|
||||||
Binaires statiques prêts à l'emploi — zéro dépendance.
|
|
||||||
|
|
||||||
### Téléchargements
|
|
||||||
- **Linux x86_64** : `ntfy-bridge-linux-x86_64`
|
|
||||||
- **Linux arm64** (Raspberry Pi) : `ntfy-bridge-linux-arm64`
|
|
||||||
- **Windows x86_64** : `ntfy-bridge-windows-x86_64.exe`
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
```bash
|
|
||||||
chmod +x ntfy-bridge-linux-x86_64
|
|
||||||
sudo mv ntfy-bridge-linux-x86_64 /usr/local/bin/ntfy-bridge
|
|
||||||
ntfy-bridge --install-service
|
|
||||||
```
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
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: Create Release
|
||||||
|
run: |
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
echo "==> Creating release ${VERSION}..."
|
||||||
|
|
||||||
|
# Supprimer une release existante avec le meme tag (si re-run)
|
||||||
|
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
"${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)
|
||||||
|
if [ -n "$EXISTING_ID" ]; then
|
||||||
|
echo " Deleting existing release #${EXISTING_ID}..."
|
||||||
|
curl -s -f -X DELETE \
|
||||||
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${EXISTING_ID}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Creer la release
|
||||||
|
RELEASE_RESP=$(curl -s -f -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-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}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases")
|
||||||
|
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
|
# Uploader les binaires
|
||||||
|
for FILE in build/*; do
|
||||||
|
FNAME=$(basename "$FILE")
|
||||||
|
echo " Uploading ${FNAME}..."
|
||||||
|
curl -s -f -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${FILE}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FNAME}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "==> Release ${VERSION} complete!"
|
||||||
Reference in New Issue
Block a user