90 lines
3.1 KiB
YAML
90 lines
3.1 KiB
YAML
name: CI Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- 'v*' # Déclenche la création de release uniquement lors du push d'un tag (ex: v1.0.0)
|
|
|
|
jobs:
|
|
inspect-build-notify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout du code source
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Afficher le chemin du workspace (PWD)
|
|
run: |
|
|
echo "=========================================="
|
|
echo " Le code est checkout dans le répertoire : "
|
|
pwd
|
|
echo "=========================================="
|
|
|
|
- name: Lister l'arborescence du projet
|
|
run: |
|
|
echo "=========================================="
|
|
echo " Contenu du répertoire checkout : "
|
|
ls -la
|
|
echo "=========================================="
|
|
|
|
- name: Créer un fichier texte avec la date du build
|
|
run: |
|
|
echo "Build effectué le : $(date)" > build-info.txt
|
|
|
|
- name: Compresser le projet en fichier ZIP
|
|
run: |
|
|
zip -r mon-projet.zip . -x "*.git*"
|
|
|
|
- name: Lister le contenu après génération du ZIP
|
|
run: |
|
|
echo "=========================================="
|
|
echo " Fichiers présents (avec le fichier ZIP) : "
|
|
pwd
|
|
ls -lh mon-projet.zip
|
|
ls -la
|
|
echo "=========================================="
|
|
|
|
- name: Téléverser l'artefact
|
|
uses: actions/upload-artifact@v3 # v3 est requis pour la compatibilité avec l'API Gitea Actions
|
|
with:
|
|
name: projet-build-zip
|
|
path: mon-projet.zip
|
|
|
|
- name: Créer une Release sur Gitea
|
|
if: startsWith(github.ref, 'refs/tags/') # S'exécute uniquement si le déclencheur est un tag Git
|
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
|
with:
|
|
state: "published"
|
|
name: "Release ${{ gitea.ref_name }}"
|
|
body: |
|
|
## 📦 Version ${{ gitea.ref_name }}
|
|
|
|
Build automatique généré par Gitea Actions.
|
|
|
|
### 📝 Détails du déploiement
|
|
* **Branche / Tag :** `${{ gitea.ref_name }}`
|
|
* **Auteur :** `${{ gitea.actor }}`
|
|
* **Commit :** `${{ gitea.sha }}`
|
|
|
|
*Retrouvez l'archive `.zip` complète du projet ci-dessous.*
|
|
files: |
|
|
mon-projet.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Envoyer une notification Telegram
|
|
if: always() # Garantit l'envoi du message même en cas d'échec d'une étape
|
|
uses: appleboy/telegram-action@master
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
message: |
|
|
🚀 **Build Gitea Actions terminé !**
|
|
|
|
📌 **Dépôt :** [${{ gitea.repository }}](https://git.ericampire.app/${{ gitea.repository }})
|
|
🌿 **Branche / Tag :** ${{ gitea.ref_name }}
|
|
👤 **Auteur :** ${{ gitea.actor }}
|
|
📊 **Statut :** ${{ job.status }}
|
|
📦 **Artefact généré :** mon-projet.zip |