sync-upstream #451
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |