fix(ci): rewrite workflow, use date-based version, fix yaml syntax
Some checks failed
Build and Release .deb / build-deb (push) Failing after 21s

This commit is contained in:
enzo 2026-05-13 00:38:22 +02:00
parent 4cf417884f
commit ff419224d8

View file

@ -20,30 +20,13 @@ jobs:
- name: Determine version - name: Determine version
working-directory: /workspace/repo working-directory: /workspace/repo
env: id: version
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: | run: |
set -e set -e
git checkout master || git checkout -b master origin/master git checkout master || git checkout -b master origin/master
if git describe --tags --exact-match HEAD 2>/dev/null; then DATE=$(date +%Y.%m.%d)
# Le commit actuel est déjà un tag SHA=$(git rev-parse --short HEAD)
VERSION=$(git describe --tags --exact-match HEAD | sed 's/^v//') VERSION="${DATE}.${SHA}"
else
# Incrémente le patch du dernier tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
VERSION_BASE=${LAST_TAG#v}
MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1)
MINOR=$(echo "$VERSION_BASE" | cut -d. -f2)
PATCH=$(echo "$VERSION_BASE" | cut -d. -f3)
NEW_PATCH=$((PATCH + 1))
VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
# Créer un tag léger pour cette release
git config user.email "ci@geronzi.fr"
git config user.name "Forgejo CI"
git remote set-url origin "http://x-access-token:${FORGEJO_TOKEN}@10.0.0.4:3000/geronzi/full_updater.git"
git tag -a "v${VERSION}" -m "Release v${VERSION}"
git push origin "v${VERSION}" || true
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Detected version: ${VERSION}" echo "Detected version: ${VERSION}"
@ -54,13 +37,7 @@ jobs:
GIT_SHA: ${{ github.sha }} GIT_SHA: ${{ github.sha }}
run: | run: |
DATE=$(date -R) DATE=$(date -R)
cat > debian/changelog << 'CHANGELOG' printf '%s\n' "full-updater (${VERSION}) unstable; urgency=medium" "" " * Auto-built release from commit ${GIT_SHA}" "" " -- Forgejo CI <ci@geronzi.fr> ${DATE}" > debian/changelog
full-updater (${VERSION}) unstable; urgency=medium
* Auto-built release from commit ${GIT_SHA}
-- Forgejo CI <ci@geronzi.fr> ${DATE}
CHANGELOG
- name: Install build dependencies - name: Install build dependencies
working-directory: /workspace/repo working-directory: /workspace/repo
@ -70,28 +47,27 @@ CHANGELOG
- name: Build .deb package - name: Build .deb package
working-directory: /workspace/repo working-directory: /workspace/repo
env:
VERSION: ${{ steps.version.outputs.version }}
run: | run: |
dpkg-buildpackage -us -uc -b -tc dpkg-buildpackage -us -uc -b -tc
mkdir -p dist mkdir -p dist
cp ../*.deb dist/ cp ../*.deb dist/
# Renommer proprement mv dist/full-updater_*.deb "dist/full-updater_${VERSION}_all.deb"
mv dist/full-updater_*.deb "dist/full-updater_${{ steps.version.outputs.version }}_all.deb"
- name: Upload release asset - name: Upload release asset
working-directory: /workspace/repo working-directory: /workspace/repo
env: env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: | run: |
VERSION=${{ steps.version.outputs.version }}
TAG="v${VERSION}" TAG="v${VERSION}"
FILE="dist/full-updater_${VERSION}_all.deb" FILE="dist/full-updater_${VERSION}_all.deb"
# Créer la release si elle n'existe pas
curl -s -X POST \ curl -s -X POST \
-H "Authorization: token ${FORGEJO_TOKEN}" \ -H "Authorization: token ${FORGEJO_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"body\": \"Automated build from main\"}" \ -d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"body\": \"Automated build from master\"}" \
"http://10.0.0.4:3000/api/v1/repos/geronzi/full_updater/releases" || true "http://10.0.0.4:3000/api/v1/repos/geronzi/full_updater/releases" || true
# Récupérer l'ID de la release
RELEASE_ID=$(curl -s -H "Authorization: token ${FORGEJO_TOKEN}" \ RELEASE_ID=$(curl -s -H "Authorization: token ${FORGEJO_TOKEN}" \
"http://10.0.0.4:3000/api/v1/repos/geronzi/full_updater/releases/latest" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))") "http://10.0.0.4:3000/api/v1/repos/geronzi/full_updater/releases/latest" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))")
if [ -n "$RELEASE_ID" ] && [ "$RELEASE_ID" != "None" ]; then if [ -n "$RELEASE_ID" ] && [ "$RELEASE_ID" != "None" ]; then
@ -103,7 +79,6 @@ CHANGELOG
fi fi
- name: Store artifact - name: Store artifact
working-directory: /workspace/repo
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: full-updater-deb name: full-updater-deb