Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 5dd7888

Browse files
author
Sameer Naik
committed
adds circle ci configuration
1 parent 6b68eb0 commit 5dd7888

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed

.circleci/config.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
version: 2.1
2+
3+
orbs:
4+
python: circleci/python@1
5+
go: circleci/go@1
6+
gcp-cli: circleci/gcp-cli@1
7+
8+
jobs:
9+
build:
10+
executor:
11+
name: python/default
12+
steps:
13+
- attach_workspace:
14+
at: ~/
15+
- checkout
16+
- run: pip install mkdocs
17+
- run:
18+
name: Building package
19+
command: make build
20+
- gcp-cli/install
21+
- gcp-cli/initialize
22+
- run:
23+
name: Building docker image
24+
command: make cloudbuild-test
25+
- persist_to_workspace:
26+
root: ~/
27+
paths:
28+
- project
29+
30+
publish-image:
31+
executor:
32+
name: gcp-cli/google
33+
steps:
34+
- attach_workspace:
35+
at: ~/
36+
- gcp-cli/initialize
37+
- run:
38+
name: Publishing docker image
39+
command: IMAGE_SHA=${CIRCLE_SHA1} IMAGE_TAG=${CIRCLE_TAG:-latest} make cloudbuild
40+
41+
release:
42+
executor:
43+
name: go/default
44+
tag: '1.15'
45+
steps:
46+
- attach_workspace:
47+
at: ~/
48+
- run:
49+
name: Building release package
50+
command: make release
51+
environment:
52+
DIST_DIR: /tmp/dist
53+
- run:
54+
name: Installing github-release tool
55+
command: go get github.com/meterup/github-release
56+
- run:
57+
name: Creating github release
58+
command: |
59+
PRE_RELEASE=${CIRCLE_TAG/${CIRCLE_TAG%-rc[0-9]*}/}
60+
github-release delete -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} 2>/dev/null ||:
61+
./scripts/release-notes.sh ${CIRCLE_TAG} | github-release release ${PRE_RELEASE:+-p} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -d -
62+
for f in $(find /tmp/dist -type f); do github-release upload -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -n $(basename ${f}) -f ${f} ; done
63+
64+
deploy:
65+
description: Patches target cluster configuration
66+
executor:
67+
name: go/default
68+
tag: '1.15'
69+
parameters:
70+
cluster:
71+
type: string
72+
committer_name:
73+
type: string
74+
default: TriggerMesh Bot
75+
committer_email:
76+
type: string
77+
78+
steps:
79+
- attach_workspace:
80+
at: ~/
81+
- add_ssh_keys
82+
- run: ssh-keyscan github.com >> ~/.ssh/known_hosts
83+
- run:
84+
name: Configuring git
85+
command: |
86+
git config --global user.name '<< parameters.committer_name >>'
87+
git config --global user.email '<< parameters.committer_email >>'
88+
- run:
89+
name: Cloning config repository
90+
command: git clone --single-branch [email protected]:triggermesh/config.git tmconfig
91+
- run:
92+
name: Updating overlays/<< parameters.cluster >>/sources manifests
93+
working_directory: tmconfig/
94+
command: |
95+
sed -i overlays/<< parameters.cluster >>/docs/deployment.yaml -e "s|gcr.io/triggermesh/docs:.*|gcr.io/triggermesh/docs:"${CIRCLE_TAG:-${CIRCLE_SHA1}}"|g"
96+
git --no-pager diff
97+
- run:
98+
name: Committing overlays/<< parameters.cluster >>/docs updates
99+
working_directory: tmconfig/
100+
command: |
101+
git add overlays
102+
git commit -m "Update overlays/<< parameters.cluster >>/docs deployment to '${CIRCLE_TAG:-${CIRCLE_SHA1}}'"
103+
git push origin master
104+
105+
workflows:
106+
build-test-and-publish:
107+
jobs:
108+
- build:
109+
context: production
110+
filters:
111+
tags:
112+
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
113+
- publish-image:
114+
context: production
115+
requires:
116+
- build
117+
filters:
118+
tags:
119+
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
120+
branches:
121+
only: master
122+
- deploy:
123+
name: update-production-config
124+
cluster: prod
125+
requires:
126+
- publish-image
127+
filters:
128+
tags:
129+
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
130+
branches:
131+
ignore: /.*/
132+
- release:
133+
context: production
134+
requires:
135+
- publish-image
136+
filters:
137+
tags:
138+
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
139+
branches:
140+
ignore: /.*/

scripts/release-notes.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env sh
2+
3+
RELEASE=${1:-${GIT_TAG}}
4+
RELEASE=${RELEASE:-${CIRCLE_TAG}}
5+
6+
if [ -z "${RELEASE}" ]; then
7+
echo "Usage:"
8+
echo "./scripts/release-notes.sh v0.1.0"
9+
exit 1
10+
fi
11+
12+
if ! git rev-list ${RELEASE} >/dev/null 2>&1; then
13+
echo "${RELEASE} does not exist"
14+
exit
15+
fi
16+
17+
PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^ 2>/dev/null)}
18+
PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^ 2>/dev/null)}
19+
NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6)
20+
CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE})
21+
if [ $? -ne 0 ]; then
22+
echo "Error creating changelog"
23+
exit 1
24+
fi
25+
26+
cat <<EOF
27+
${NOTABLE_CHANGES}
28+
29+
## Installation
30+
31+
Download Triggermesh Docs ${RELEASE}
32+
33+
- [container](https://gcr.io/triggermesh/docs:${RELEASE})
34+
35+
## Changelog
36+
37+
${CHANGELOG}
38+
EOF

0 commit comments

Comments
 (0)