-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (53 loc) · 2.81 KB
/
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
47
48
49
50
51
52
53
name: CI
on:
push:
paths-ignore:
- '**.md'
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- env:
DOCKER_APP_IMAGE_NAME: "ghcr.io/hasadna/open-bus-pipelines/open-bus-pipelines"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HASADNA_K8S_DEPLOY_KEY: ${{ secrets.HASADNA_K8S_DEPLOY_KEY }}
run: |
curl -s https://raw.githubusercontent.com/OriHoch/uumpa-ci-toolbox/65a0704332e63d51f63981dbb25cd83682dc4078/bin/github_actions_install.sh \
| bash -s 65a0704332e63d51f63981dbb25cd83682dc4078 OriHoch/uumpa-ci-toolbox &&\
uci github actions self-checkout --config-user-name "open-bus-pipelines-ci" &&\
uci github actions docker-login &&\
uci docker build-cache \
--cache-from "${DOCKER_APP_IMAGE_NAME}:latest" \
-- -t app . &&\
uci docker tag-push \
--source-tag-name app \
--push-tag-name "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
mkdir -p docgen_output &&\
docker run -v "`pwd`:/srv" --entrypoint python app bin/etl_docgen.py docgen_output &&\
if ! diff docgen_output/STRIDE_ETL_PROCESSES.md ./STRIDE_ETL_PROCESSES.md; then
cp -f docgen_output/STRIDE_ETL_PROCESSES.md ./STRIDE_ETL_PROCESSES.md &&\
git add ./STRIDE_ETL_PROCESSES.md &&\
git commit -m "automatic update of the etl processes documentation" &&\
git push
fi &&\
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
docker tag app "${DOCKER_APP_IMAGE_NAME}:latest" &&\
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy \
&& ! git log -1 --pretty=format:"%s" | grep '^automatic update of siri etl requirements$' \
&& ! git log -1 --pretty=format:"%s" | grep '^automatic update of gtfs etl requirements$' \
&& ! git log -1 --pretty=format:"%s" | grep '^automatic update of stride etl requirements$'
then
cd `mktemp -d` &&\
echo "${HASADNA_K8S_DEPLOY_KEY}" > hasadna_k8s_deploy_key &&\
chmod 400 hasadna_k8s_deploy_key &&\
export GIT_SSH_COMMAND="ssh -i `pwd`/hasadna_k8s_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\
git clone [email protected]:hasadna/hasadna-k8s.git &&\
cd hasadna-k8s &&\
python update_yaml.py '{"pipelinesImage":"'"${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/openbus/values-hasadna-auto-updated.yaml &&\
git config --global user.name "Open Bus Pipelines CI" &&\
git config --global user.email "open-bus-pipelines-ci@localhost" &&\
git add apps/openbus/values-hasadna-auto-updated.yaml && git commit -m "automatic update of open bus pipelines" &&\
git push origin master
fi
fi