fix(ci): rewrite workflow, use date-based version, fix yaml syntax
Some checks failed
Build and Release .deb / build-deb (push) Failing after 21s
Some checks failed
Build and Release .deb / build-deb (push) Failing after 21s
This commit is contained in:
parent
4cf417884f
commit
ff419224d8
1 changed files with 10 additions and 35 deletions
|
|
@ -20,30 +20,13 @@ jobs:
|
|||
|
||||
- name: Determine version
|
||||
working-directory: /workspace/repo
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
id: version
|
||||
run: |
|
||||
set -e
|
||||
git checkout master || git checkout -b master origin/master
|
||||
if git describe --tags --exact-match HEAD 2>/dev/null; then
|
||||
# Le commit actuel est déjà un tag
|
||||
VERSION=$(git describe --tags --exact-match HEAD | sed 's/^v//')
|
||||
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
|
||||
DATE=$(date +%Y.%m.%d)
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
VERSION="${DATE}.${SHA}"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "Detected version: ${VERSION}"
|
||||
|
||||
|
|
@ -54,13 +37,7 @@ jobs:
|
|||
GIT_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
DATE=$(date -R)
|
||||
cat > debian/changelog << 'CHANGELOG'
|
||||
full-updater (${VERSION}) unstable; urgency=medium
|
||||
|
||||
* Auto-built release from commit ${GIT_SHA}
|
||||
|
||||
-- Forgejo CI <ci@geronzi.fr> ${DATE}
|
||||
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
|
||||
|
||||
- name: Install build dependencies
|
||||
working-directory: /workspace/repo
|
||||
|
|
@ -70,28 +47,27 @@ CHANGELOG
|
|||
|
||||
- name: Build .deb package
|
||||
working-directory: /workspace/repo
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
dpkg-buildpackage -us -uc -b -tc
|
||||
mkdir -p dist
|
||||
cp ../*.deb dist/
|
||||
# Renommer proprement
|
||||
mv dist/full-updater_*.deb "dist/full-updater_${{ steps.version.outputs.version }}_all.deb"
|
||||
mv dist/full-updater_*.deb "dist/full-updater_${VERSION}_all.deb"
|
||||
|
||||
- name: Upload release asset
|
||||
working-directory: /workspace/repo
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
TAG="v${VERSION}"
|
||||
FILE="dist/full-updater_${VERSION}_all.deb"
|
||||
# Créer la release si elle n'existe pas
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-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
|
||||
# Récupérer l'ID de la release
|
||||
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',''))")
|
||||
if [ -n "$RELEASE_ID" ] && [ "$RELEASE_ID" != "None" ]; then
|
||||
|
|
@ -103,7 +79,6 @@ CHANGELOG
|
|||
fi
|
||||
|
||||
- name: Store artifact
|
||||
working-directory: /workspace/repo
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: full-updater-deb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue