1+ # When the main branch of this repo has a push, push corresponding history in
2+ # the repos mirroring subdirectories of this repo.
3+
4+ name : Sync component mirror repos
5+
6+ on :
7+ push :
8+ branches :
9+ - main
10+
11+ jobs :
12+ sync-component-mirrors :
13+ name : Sync component mirrors
14+ if : github.repository == 'micro-manager/mmCoreAndDevices'
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+ path : mmCoreAndDevices
21+
22+ - run : pip install git-filter-repo
23+
24+ - name : Set up SSH
25+ run : |
26+ mkdir -p ~/.ssh
27+
28+ # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
29+ cat >> ~/.ssh/known_hosts <<EOF
30+ github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
31+ EOF
32+
33+ cat >> ~/.ssh/config <<EOF
34+ Host github.com
35+ HostName github.com
36+ User git
37+ IdentityFile ~/.ssh/deploy_key
38+ EOF
39+ chmod 600 ~/.ssh/config
40+
41+ - name : Rewrite history using road-not-taken tag
42+ run : |
43+ cd mmCoreAndDevices
44+ # "Rebase" onto road-not-taken (0719c75); see mmCoreAndDevices #691.
45+ git filter-repo --commit-callback '
46+ if commit.original_id == b"6c996be297b40eed03b8f8a8532e86b1b7d265aa":
47+ commit.parents = [b"0719c750d34ca957ab5739ab144e25a27e92ab1e"]
48+ '
49+
50+ - name : Extract mmdevice history
51+ run : |
52+ cp -R mmCoreAndDevices mmdevice
53+ cd mmdevice
54+ git filter-repo --subdirectory-filter MMDevice
55+ git checkout main
56+ git branch |grep -v '^\*' |xargs git branch -D
57+ git tag |grep -v '^device-interface-' |xargs git tag -d
58+
59+ - name : Extract mmcore history
60+ run : |
61+ cp -R mmCoreAndDevices mmcore
62+ cd mmcore
63+ git filter-repo --subdirectory-filter MMCore
64+ git checkout main
65+ git branch |grep -v '^\*' |xargs git branch -D
66+ git tag |xargs git tag -d
67+
68+ - name : Push mmdevice
69+ env :
70+ SSH_DEPLOY_KEY : ${{ secrets.SSH_KEY_DEPLOY_TO_MMDEVICE }}
71+ run : |
72+ echo "$SSH_DEPLOY_KEY" > ~/.ssh/deploy_key
73+ chmod 600 ~/.ssh/deploy_key
74+
75+ cd mmdevice
76+ git remote add origin git@github.com:micro-manager/mmdevice.git
77+ git push -u origin main --follow-tags
78+
79+ - name : Push mmcore
80+ env :
81+ SSH_DEPLOY_KEY : ${{ secrets.SSH_KEY_DEPLOY_TO_MMCORE }}
82+ run : |
83+ echo "$SSH_DEPLOY_KEY" > ~/.ssh/deploy_key
84+ chmod 600 ~/.ssh/deploy_key
85+
86+ cd mmcore
87+ git remote add origin git@github.com:micro-manager/mmcore.git
88+ git push -u origin main
0 commit comments