-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (38 loc) · 1.52 KB
/
mirror.yaml
File metadata and controls
42 lines (38 loc) · 1.52 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
name: Sync to Public Mirror
on:
workflow_run:
workflows: [CI]
types:
- completed
branches:
- main
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
- name: Update README for public mirror
run: |
sed -i 's|childmindresearch/rbc.git|childmindresearch/rbc-mirror.git|g' README.md
sed -i 's|childmindresearch/rbc|childmindresearch/rbc-mirror|g' src/rbc/context.py
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md src/rbc/context.py
git diff --staged --quiet || git commit -m "chore: update URLs to public mirror"
- name: Push to public mirror
env:
MIRROR_DEPLOY_KEY: ${{ secrets.RBC_MIRROR_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "${MIRROR_DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Trust GH public host key
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" >> ~/.ssh/known_hosts
git remote add mirror git@github.com:childmindresearch/rbc-mirror.git
echo "Pushing commit $(git rev-parse HEAD) to public mirror"
git push mirror HEAD:main --force