-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (35 loc) · 1.13 KB
/
sync-with-upstream.yml
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
name: Synchronization
on:
repository_dispatch:
types: [ sync-upstream ]
jobs:
sync-with-upstream:
runs-on: ubuntu-latest
steps:
- name: Fetch Upstream clusternet/clusternet
uses: actions/checkout@v3
with:
repository: clusternet/clusternet
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 0
- name: Update changes
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git subtree split -P pkg/apis -b subrepo-apis
git init ../tmp-apis
git remote add tmp-apis ../tmp-apis
git push -u tmp-apis subrepo-apis:main
cd ../tmp-apis
git checkout main
git remote add origin "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/clusternet/apis.git"
GITHUB_REF=${{ github.event.client_payload.ref }}
if [[ $GITHUB_REF == refs/tags/* ]]
then
TAG=${GITHUB_REF/refs\/tags\//}
git tag $TAG
git push --tags origin $TAG
else
git push origin main
fi