Skip to content

update requirements.txt #18

update requirements.txt

update requirements.txt #18

Workflow file for this run

name: CI
on:
push:
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- env:
DOCKER_APP_IMAGE_NAME: "ghcr.io/hasadna/open-pension-ng/open-pension-ng-app"
DOCKER_NGINX_IMAGE_NAME: "ghcr.io/hasadna/open-pension-ng/open-pension-ng-nginx"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HASADNA_K8S_DEPLOY_KEY: ${{ secrets.HASADNA_K8S_DEPLOY_KEY }}
MAIN_BRANCH: main
run: |
echo "${GITHUB_TOKEN}" | docker login ghcr.io -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 --build-arg VERSION=${GITHUB_SHA} -t open-pension-ng . &&\
docker tag open-pension-ng "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
docker push "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
if docker pull "${DOCKER_NGINX_IMAGE_NAME}:latest"; then
CACHE_FROM_ARG="--cache-from ${DOCKER_NGINX_IMAGE_NAME}:latest"
else
CACHE_FROM_ARG=""
fi &&\
docker build $CACHE_FROM_ARG --build-arg VERSION=${GITHUB_SHA} -t nginx -f nginx.Dockerfile . &&\
docker tag nginx "${DOCKER_NGINX_IMAGE_NAME}:${GITHUB_SHA}" &&\
docker push "${DOCKER_NGINX_IMAGE_NAME}:${GITHUB_SHA}" &&\
if [ "${GITHUB_REF}" == "refs/heads/${MAIN_BRANCH}" ]; then
docker tag open-pension-ng "${DOCKER_APP_IMAGE_NAME}:latest" &&\
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\
docker tag nginx "${DOCKER_NGINX_IMAGE_NAME}:latest" &&\
docker push "${DOCKER_NGINX_IMAGE_NAME}:latest" &&\
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; 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 '{"ngAppImage":"'"${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}"'","ngNginxImage":"'"${DOCKER_NGINX_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/openpension/values-hasadna-auto-updated.yaml &&\
git config --global user.name "open-pension-ng CI" &&\
git config --global user.email "open-pension-ng-ci@localhost" &&\
git add apps/openpension/values-hasadna-auto-updated.yaml && git commit -m "automatic update of open-pension-ng app" &&\
git push origin master
fi
fi