File: github_mirror.sh

package info (click to toggle)
lfortran 0.58.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 54,512 kB
  • sloc: cpp: 162,179; f90: 68,251; python: 17,476; ansic: 6,278; yacc: 2,334; sh: 1,317; fortran: 892; makefile: 33; javascript: 15
file content (42 lines) | stat: -rwxr-xr-x 920 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env bash

set -e
set -x

if [[ $CI_COMMIT_REF_NAME != "master" ]]; then
    echo "Not on master, skipping mirroring"
    exit 0
else
    echo "On master, mirroring to GitHub"
fi

mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts

eval "$(ssh-agent -s)"

set +x
if [[ "${SSH_PRIVATE_KEY_MIRROR}" == "" ]]; then
    echo "Error: SSH_PRIVATE_KEY_MIRROR is empty."
    exit 1
fi
# Generate the private/public key pair using:
#
#     ssh-keygen -f deploy_key -N ""
#
# then set the $SSH_PRIVATE_KEY_MIRROR environment variable in the GitLab-CI to
# the base64 encoded private key:
#
#     cat deploy_key | base64 -w0
#
# and add the public key `deploy_key.pub` into the target git repository (with
# write permissions).

ssh-add <(echo "$SSH_PRIVATE_KEY_MIRROR" | base64 -d)
set -x

pwd
git show-ref
git remote -v
git push git@github.com:lfortran/lfortran.git +origin/master:master --tags