automatic update of open bus stride api dependencies #190
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: | |
jobs: | |
ci: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- env: | |
DOCKER_APP_IMAGE_NAME: "docker.pkg.github.com/hasadna/open-bus-stride-etl/open-bus-stride-etl" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OPEN_BUS_PIPELINES_DEPLOY_KEY: ${{ secrets.OPEN_BUS_PIPELINES_DEPLOY_KEY }} | |
run: | | |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u hasadna --password-stdin &&\ | |
if docker pull "${DOCKER_APP_IMAGE_NAME}:latest"; then | |
CACHE_FROM_ARG="--cache-from ${DOCKER_APP_IMAGE_NAME}:latest" | |
else | |
CACHE_FROM_ARG="" | |
fi &&\ | |
docker build $CACHE_FROM_ARG -t app . &&\ | |
docker tag app "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
docker push "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
python3 -m pip install ruamel.yaml.clib==0.2.6 ruamel.yaml==0.17.21 &&\ | |
bin/validate_airflow_yaml.py airflow.yaml &&\ | |
git config --global user.name "Open Bus Stride ETL CI" &&\ | |
git config --global user.email "open-bus-stride-etl-ci@localhost" &&\ | |
OPEN_BUS_STRIDE_ETL_ROOTDIR="$(pwd)" &&\ | |
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; then | |
cd `mktemp -d` &&\ | |
echo "${OPEN_BUS_PIPELINES_DEPLOY_KEY}" > open_bus_pipelines_deploy_key &&\ | |
chmod 400 open_bus_pipelines_deploy_key &&\ | |
export GIT_SSH_COMMAND="ssh -i `pwd`/open_bus_pipelines_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\ | |
git clone [email protected]:hasadna/open-bus-pipelines.git &&\ | |
cd open-bus-pipelines &&\ | |
( cd $OPEN_BUS_STRIDE_ETL_ROOTDIR && bin/get_stride_etl_requirements.py "${GITHUB_SHA}" ) > requirements-stride-etl.txt &&\ | |
git add requirements-stride-etl.txt &&\ | |
git commit -m "automatic update of stride etl requirements" &&\ | |
git push origin main | |
fi | |
fi |