Add simple CI
This commit is contained in:
1 parent
20b8fcc1c1
commit
3d61740f5a
5 files changed
+152
No files matched your search
@@ -0,0 +1,82 @@
|
||||
# Vérifications à chaque push / pull request, et release Gitea avec le paquet FreeStore
|
||||
# sur un tag « vX.Y.Z » (qui doit correspondre à « version » dans manifest.json).
|
||||
# Le téléversement sur la console FreeFactory reste manuel (pas d'API connue).
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Vérifications et paquet
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Dépendances (Qt 5, qmllint, libfbxqml)
|
||||
run: |
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y -qq --no-install-recommends \
|
||||
python3 git ca-certificates qmlscene qtdeclarative5-dev-tools \
|
||||
qml-module-qtquick2 qml-module-qtquick-window2 qml-module-qtmultimedia
|
||||
git clone --depth 1 https://github.com/fbx/libfbxqml.git ../libfbxqml
|
||||
|
||||
- name: Manifest, syntaxe QML/JS et paquet FreeStore
|
||||
run: python3 tools/package.py
|
||||
|
||||
- name: Chargement en HTTP, comme sur la box
|
||||
run: tools/check-load.sh
|
||||
|
||||
- name: Paquet en artefact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: freestore-package
|
||||
path: dist/*.tar.gz
|
||||
|
||||
release:
|
||||
name: Release Gitea
|
||||
needs: check
|
||||
if: startsWith(gitea.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Dépendances
|
||||
run: |
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y -qq --no-install-recommends \
|
||||
python3 curl ca-certificates
|
||||
|
||||
- name: Le tag correspond à la version du manifest
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
VERSION=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])")
|
||||
if [ "$TAG" != "v$VERSION" ]; then
|
||||
echo "Le tag $TAG ne correspond pas à la version du manifest (v$VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: freestore-package
|
||||
path: dist
|
||||
|
||||
- name: Créer la release et joindre le paquet
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
FILE=$(ls dist/*.tar.gz)
|
||||
BODY=$(python3 -c "import json,sys; print(json.dumps({'tag_name': sys.argv[1], 'name': sys.argv[1], 'body': 'Paquet FreeStore à téléverser sur la console FreeFactory (http://factory.free.fr).'}))" "$TAG")
|
||||
ID=$(curl -sSf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
"$API/releases" -d "$BODY" | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")
|
||||
curl -sSf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$FILE" \
|
||||
"$API/releases/$ID/assets?name=$(basename "$FILE")" > /dev/null
|
||||
echo "Release $TAG créée avec $(basename "$FILE")."
|
||||
Reference in new issue
Block a user