-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (39 loc) · 1.42 KB
/
cluster-ci.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
46
name: Transpire Module CI
on:
workflow_call:
inputs:
module_name:
type: string
secrets:
OCF_CLUSTER_DEPLOY_KEY:
required: true
jobs:
build-cluster:
runs-on: ubuntu-latest
container: ghcr.io/ocf/transpire:latest
steps:
- uses: actions/checkout@v3
with:
repository: ocf/kubernetes
- name: Build cluster repository
run: >
transpire object build _out ${{ inputs.module_name != '' &&
format('--module {0}', inputs.module_name) || '' }}
- name: Push cluster repository
run: |
mkdir $HOME/.ssh
echo "${{ secrets.OCF_CLUSTER_DEPLOY_KEY }}" > $HOME/.ssh/deploy_key
chmod 600 $HOME/.ssh/deploy_key
ssh-keyscan -H github.com > $HOME/.ssh/known_hosts
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/deploy_key -o UserKnownHostsFile=$HOME/.ssh/known_hosts"
CLONE_DIR=$(mktemp -d)
git clone --single-branch --depth 1 git@github.com:ocf/cluster.git $CLONE_DIR
cp -r _out/* $CLONE_DIR
cd $CLONE_DIR
git config --bool core.bare false
git config --bool push.autoSetupRemote true
git config user.email ocfbot@ocf.berkeley.edu
git config user.name ocfbot
git add -A
git commit -m "chore: rebuild cluster repository" -m "triggered by: ${{ inputs.module_name }}" --allow-empty
git push