You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.3 KiB
27 lines
1.3 KiB
name: Mise à jour automatique du programme
|
|
# on:
|
|
# schedule:
|
|
# - cron: '0 * * * *' # Exécute la pipeline toutes les heures
|
|
on: [workflow_dispatch]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Extraire la valeur HTML spécifique
|
|
run: |
|
|
wget -O - https://glpi-project.org/fr/telecharger-glpi/ | grep "<p style=\"text-align: center;\">GLPI VERSION" | sed -n 's/.*GLPI VERSION \([0-9.]*\).*/\1/p' > current_version.txt
|
|
- name: Comparer les versions
|
|
run: |
|
|
if ! diff current_version.txt <(echo ${{ secrets.PROGRAM_VERSION }}); then
|
|
echo "Une nouvelle version du programme est disponible."
|
|
export PROGRAM_VERSION=$(cat current_version.txt)
|
|
# Continuer le processus de mise à jour ici
|
|
|
|
# Envoyer une demande PATCH à l'API GitHub pour mettre à jour la variable secrète
|
|
echo -n $PROGRAM_VERSION | base64 --wrap=0 > program_version_base64.txt
|
|
curl -X PATCH -H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/<OWNER>/<REPO>/actions/secrets/PROGRAM_VERSION -d '{"encrypted_value":"'"$(cat program_version_base64.txt)"'"}'
|
|
else
|
|
echo "Le programme est à jour."
|
|
exit 1 # Arrête la pipeline avec un code d'erreur
|
|
fi
|