mirror of
https://github.com/tiennm99/tiennm99.github.io.git
synced 2026-10-11 03:13:44 +00:00
ci(mirror): push to both the user and group GitLab Pages projects
This commit is contained in:
1 parent
73bcdea27b
commit
5efd6256d8
1 file changed
+13
-12
@@ -33,26 +33,27 @@ jobs:
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
# Add GitLab remote
|
||||
git remote add gitlab git@gitlab.com:miti99/miti99.gitlab.io.git
|
||||
|
||||
# Fetch from GitLab to get information about the default branch
|
||||
git fetch gitlab
|
||||
|
||||
# Get current branch name
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
# Get list of local branches
|
||||
LOCAL_BRANCHES=$(git branch | grep -v "origin/" | tr -d '* ' | tr '\n' ' ')
|
||||
|
||||
# Mirror to the Pages project of both the user and the group namespace
|
||||
for repo in tiennm99/tiennm99.gitlab.io miti99/miti99.gitlab.io; do
|
||||
remote="gitlab-${repo%%/*}"
|
||||
|
||||
# Add GitLab remote
|
||||
git remote add "$remote" "git@gitlab.com:$repo.git"
|
||||
|
||||
# Fetch from GitLab to get information about the default branch
|
||||
git fetch "$remote"
|
||||
|
||||
# Push each local branch individually to GitLab
|
||||
for branch in $LOCAL_BRANCHES; do
|
||||
# Push branch to GitLab
|
||||
git push gitlab $branch:$branch --force
|
||||
git push "$remote" "$branch:$branch" --force
|
||||
done
|
||||
|
||||
# Push all tags
|
||||
git push gitlab --tags --force
|
||||
git push "$remote" --tags --force
|
||||
done
|
||||
|
||||
- name: Mirror to Bitbucket
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user