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.
40 lines
1.5 KiB
40 lines
1.5 KiB
name: Mise à jour automatique du programme
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *' # Exécute la pipeline toutes les heures
|
|
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
|
|
export PROGRAM_VERSION_LATEST=$(cat current_version.txt)
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Configurer Git
|
|
run: |
|
|
git config user.name "GitHub Actions Bot"
|
|
git config user.email "actions@github.com"
|
|
|
|
- name: Comparer et mettre à jour la version
|
|
run: |
|
|
export PROGRAM_VERSION=$(grep "PROGRAM_VERSION" .github/variables/repository-variables.env | sed -n 's/.*PROGRAM_VERSION=\([0-9.]*\).*/\1/p')
|
|
echo "PROGRAM_VERSION=$PROGRAM_VERSION"
|
|
echo "PROGRAM_VERSION_LATEST=$PROGRAM_VERSION_LATEST"
|
|
|
|
if [ "$PROGRAM_VERSION" != "$PROGRAM_VERSION_LATEST" ]; then
|
|
sed -i "s/PROGRAM_VERSION=$PROGRAM_VERSION/PROGRAM_VERSION=$PROGRAM_VERSION_LATEST/" .github/variables/repository-variables.env
|
|
git add .github/variables/repository-variables.env
|
|
git commit -m "Mise à jour de la version de GLPI à $PROGRAM_VERSION_LATEST"
|
|
git push
|
|
else
|
|
echo "La version de GLPI est déjà à jour"
|
|
exit 1
|
|
fi
|