cloudflare/cloudflared

Public

mirrored fromhttps://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2026.5.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.ci/scripts/github-push.sh

31lines · modecode

1#!/bin/bash
2set -e -u -o pipefail
3
4BRANCH="master"
5TMP_PATH="$PWD/tmp"
6PRIVATE_KEY_PATH="$TMP_PATH/github-deploy-key"
7PUBLIC_KEY_GITHUB_PATH="$TMP_PATH/github.pub"
8
9mkdir -p $TMP_PATH
10
11# Setup Private Key
12echo "$CLOUDFLARED_DEPLOY_SSH_KEY" > $PRIVATE_KEY_PATH
13chmod 400 $PRIVATE_KEY_PATH
14
15# Download GitHub Public Key for KnownHostsFile
16ssh-keyscan -t ed25519 github.com > $PUBLIC_KEY_GITHUB_PATH
17
18# Setup git ssh command with the right configurations
19export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=$PUBLIC_KEY_GITHUB_PATH -o IdentitiesOnly=yes -i $PRIVATE_KEY_PATH"
20
21# Add GitHub as a new remote
22git remote add github git@github.com:cloudflare/cloudflared.git || true
23
24# GitLab doesn't pull branch references, instead it creates a new one on each pipeline.
25# Therefore, we need to manually fetch the reference to then push it to GitHub.
26git fetch origin $BRANCH:$BRANCH
27git push -u github $BRANCH
28
29if TAG="$(git describe --tags --exact-match 2>/dev/null)"; then
30 git push -u github "$TAG"
31fi
32