This repository was archived by the owner on Dec 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
50 lines (41 loc) · 2.03 KB
/
sync.yml
File metadata and controls
50 lines (41 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Sync Repositories
on:
push:
branches:
- main # Déclencher ce workflow sur chaque push vers la branche `main` de mobifer
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout mobifer repository
uses: actions/checkout@v3
with:
repository: Mobifer/mobifer
token: ${{ secrets.GH_TOKEN }}
ref: main # Vérifier les fichiers sur la branche principale de mobifer
- name: Clone mobifer.github.io repository
run: |
# Cloner mobifer.github.io pour y copier les fichiers
git clone --single-branch --branch main https://github.com/Mobifer/mobifer.github.io.git
- name: Copy files from mobifer to mobifer.github.io
run: |
# Utilisation de rsync pour copier les fichiers du repository mobifer dans mobifer.github.io
# Exclure les répertoires .git et mobifer.github.io
rsync -av --exclude='.git' --exclude='mobifer.github.io' --exclude='.github/workflows/sync.yml' --exclude='.github/workflows/build.yml' ./ mobifer.github.io/
- name: Remove embedded git repository (if any)
run: |
cd mobifer.github.io
# Si le répertoire "mobifer" a été ajouté comme sous-module, on le supprime
git rm --cached mobifer || echo "No submodule to remove"
- name: Commit and push changes to mobifer.github.io
run: |
cd mobifer.github.io
# Configurer Git pour utiliser GH_TOKEN pour l'authentification
git remote set-url origin https://github.com/Mobifer/mobifer.github.io.git
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@users.noreply.github.com"
# Utilisation de GH_TOKEN pour authentification dans le push
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/Mobifer/mobifer.github.io.git
git add .
git commit -m "Sync changes from mobifer" || echo "No changes to commit"
git push origin main # Pousse les changements dans mobifer.github.io