-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.43 KB
/
sync-bitbucket.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
36
37
38
39
40
41
42
43
44
45
# This action mirrors the cypress-realworld-app github repo into a Bitbucket Repo
# github.com/cypress-io/cypress-realworld-app -> bitbucket.org/cypress-io/cypress-realworld-app
name: Sync Bitbucket over SSH
on:
push:
branches:
- develop
# set the BB_REPO variable to the destination bitbucket workspace name
env:
BB_ROOT: [email protected]:cypress-io
jobs:
syncbb:
name: Synch from Github to Bitbucket using SSH
runs-on: ubuntu-latest
steps:
- name: Clone the github repo
uses: actions/checkout@v2
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.BITBUCKET_SSH_KEY }}
name: id_rsa # optional
known_hosts: ${{ secrets.BITBUCKET_KNOWN_HOSTS }}
config:
Host bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
- uses: franzdiebold/github-env-vars-action@v2
- name: sync with bitbucket
run: |
cd $GITHUB_WORKSPACE
# update the entire repo including tags/branches; prune out deleted items
echo sync with $BB_ROOT/$CI_REPOSITORY_NAME
git fetch --prune --unshallow
# make the bitbucket repo a remote called sync
git remote add sync $BB_ROOT/$CI_REPOSITORY_NAME
# force push the sync remote with all changes.
git push --force --set-upstream -v --all sync