This repository has been archived by the owner on Nov 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpromote.sh
executable file
·57 lines (42 loc) · 1.62 KB
/
promote.sh
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
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
export CREATED_TIME=$(date '+%a-%b-%d-%Y-%H-%M-%S')
export LOCAL_BRANCH_NAME="changes-${CREATED_TIME,,}"
echo "creating branch $LOCAL_BRANCH_NAME"
# lets setup git
jx step git credentials
git config --global --add user.name JenkinsXBot
git config --global --add user.email jenkins-x@googlegroups.com
jx step create pr regex \
--regex 'version: (.*)' \
--version ${VERSION} \
--files git/github.com/jenkins-x-labs/cloud-resources.yml \
--repo https://github.com/jenkins-x/jxr-versions.git
mkdir -p /tmp/docgen
pushd /tmp/docgen
export DOC_GEN_VERSION="0.0.2"
echo "downloading cli-doc-gen version $DOC_GEN_VERSION"
curl -L https://github.com/jenkins-x-labs/cli-doc-gen/releases/download/v$DOC_GEN_VERSION/cli-doc-gen-linux-amd64.tar.gz | tar xzv
popd
git clone https://github.com/jenkins-x/jx-docs.git
pushd jx-docs
git checkout -b $LOCAL_BRANCH_NAME
popd
pushd /tmp
git clone https://github.com/jenkins-x-labs/cloud-resources.git
popd
MESSAGE="chore: updated GCP cloud resources docs"
pushd jx-docs/layouts/shortcodes
/tmp/docgen/cli-doc-gen -f /tmp/cloud-resources/gcloud/create_cluster.sh -o gcp-create-cluster.html
/tmp/docgen/cli-doc-gen -f /tmp/cloud-resources/gcloud/setup_resources.sh -o gcp-create-resources.html --trim-prefix="retry "
/tmp/docgen/cli-doc-gen -f /tmp/cloud-resources/kind/create_cluster.sh -o kind-create-cluster.html
git add *
git commit --allow-empty -a -m "$MESSAGE"
popd
pushd jx-docs
git push origin $LOCAL_BRANCH_NAME
jx create pullrequest -t "$MESSAGE" -l updatebot
popd
echo "created Pull Request"