1984cf9bd3
All checks were successful
build configuration / build_storage01 (push) Successful in 48s
build configuration / build_web01 (push) Successful in 47s
build configuration / build_compute01 (push) Successful in 1m25s
npins update / npins_update (push) Successful in 1m5s
ds-fr update / npins_update (push) Successful in 33s
55 lines
1.7 KiB
YAML
55 lines
1.7 KiB
YAML
name: ds-fr update
|
|
on:
|
|
schedule:
|
|
# Run at 8 o'clock every day
|
|
- cron: "0 8 * * *"
|
|
|
|
jobs:
|
|
npins_update:
|
|
runs-on: nix
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Update DS and open PR if necessary
|
|
run: |
|
|
# Fetch the latest release tag
|
|
VERSION=$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/demarches-simplifiees/demarches-simplifiees.fr/releases/latest \
|
|
| jq '.tag_name')
|
|
|
|
# Move to the ds-fr directory
|
|
cd machines/compute01/ds-fr/package
|
|
|
|
# Run the update script
|
|
./update.sh -v "$VERSION"
|
|
|
|
if [ ! -z "$(git diff --name-only)" ]; then
|
|
echo "[+] Changes detected, pushing updates."
|
|
|
|
git switch -C ds-update
|
|
|
|
git add .
|
|
|
|
git config user.name "DGNum Chores"
|
|
git config user.email "tech@dgnum.eu"
|
|
|
|
git commit --message "chore(ds-fr): Update"
|
|
git push --set-upstream origin ds-update --force
|
|
|
|
# Connect to the server with the cli
|
|
tea login add \
|
|
-n dgnum-chores \
|
|
-t '${{ secrets.TEA_DGNUM_CHORES_TOKEN }}' \
|
|
-u https://git.dgnum.eu
|
|
|
|
# Create a pull request if needed
|
|
# i.e. no PR with the same title exists
|
|
if [ -z "$(tea pr ls -f='title,author' -o simple | grep 'chore(ds-fr): Update dgnum-chores')" ]; then
|
|
tea pr create \
|
|
--description "Automatic ds-fr update" \
|
|
--title "chore(ds-fr): Update" \
|
|
--head ds-update
|
|
fi
|
|
fi
|