automatic update of stride etl requirements #375
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |