Update README with Latest GLPI Version #598
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update README with Latest GLPI Version | |
| on: | |
| # Cela peut être un push sur la branche principale | |
| push: | |
| branches: | |
| - main | |
| # Ou planifier l'action de mise à jour tous les jours (optionnel) | |
| schedule: | |
| - cron: '0 0 * * *' # Tous les jours à minuit UTC | |
| jobs: | |
| update-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Get the latest GLPI release info | |
| id: glpi_release | |
| run: | | |
| latest_version=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | jq -r '.tag_name') | |
| echo "LATEST_VERSION=$latest_version" >> $GITHUB_ENV | |
| - name: Update README.md with the latest version | |
| run: | | |
| # Lire le fichier README.md actuel | |
| readme_content=$(cat README.md) | |
| # Ajouter ou remplacer la section de la version de GLPI | |
| new_version_info="### Latest version of GLPI : $LATEST_VERSION" | |
| # Remplacer ou ajouter la section dans le README | |
| if grep -q "### Latest version of GLPI" README.md; then | |
| # Si la section existe déjà, la remplacer | |
| sed -i "s/### Latest version of GLPI.*/$new_version_info/" README.md | |
| else | |
| # Sinon, l'ajouter à la fin | |
| echo -e "$new_version_info" >> README.md | |
| fi | |
| - name: Commit and push changes to README.md | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: "GitHub Actions" | |
| author_email: "actions@github.com" | |
| message: "Mise à jour du README avec la dernière version de GLPI" |