Skip to content

Commit 9f03145

Browse files
committed
ci: add script to automatically update the project from upstream every day
1 parent e4116ec commit 9f03145

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,19 @@ jobs:
8888
cancel-in-progress: true
8989
needs:
9090
- check_if_version_upgraded
91+
<<<<<<< HEAD
9192
if: needs.check_if_version_upgraded.outputs.is_upgraded_in_preprod == 'true'
93+
=======
94+
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
95+
>>>>>>> 0b3f684d (ci: add script to automatically update the project from upstream every day)
9296
env:
9397
TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
9498
steps:
9599
- run: echo "Triggering production deploy"
96100
- name: Set up SSH
97101
run: |
98102
mkdir -p ~/.ssh
99-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
103+
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
100104
chmod 600 ~/.ssh/id_ed25519
101105
ssh-keyscan code.gouv.fr >> ~/.ssh/known_hosts
102106
@@ -128,14 +132,15 @@ jobs:
128132
needs:
129133
- trigger_pre_production_deploy
130134
- check_if_version_upgraded
135+
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
131136
env:
132137
TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
133138
steps:
134139
- run: echo "Triggering production deploy"
135140
- name: Set up SSH
136141
run: |
137142
mkdir -p ~/.ssh
138-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
143+
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
139144
chmod 600 ~/.ssh/id_ed25519
140145
ssh-keyscan code.gouv.fr >> ~/.ssh/known_hosts
141146
ssh -o StrictHostKeyChecking=no [email protected] "bash -c 'eval \"\$(ssh-agent -s)\" && ssh-add ~/.ssh/sill-data && ./update-sill-docker-compose.sh v${{ env.TO_VERSION }}'"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * *' # every day at 7 AM UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync:
10+
name: Sync repository with upstream repository
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout fork
14+
uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.PAT_FOR_UPSTREAM_SYNC }}
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "github-actions[bot]"
22+
git config user.email "github-actions[bot]@users.noreply.github.com"
23+
24+
- name: Add upstream remote
25+
run: |
26+
git remote add upstream https://github.com/codegouvfr/sill.git
27+
git fetch upstream
28+
29+
- name: Sync with upstream/main
30+
run: |
31+
git checkout main
32+
git rebase upstream/main
33+
34+
- name: Push to origin
35+
run: git push origin main --force-with-lease --no-verify

0 commit comments

Comments
 (0)