Deployment Pipeline #27
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: Deployment Pipeline | |
on: | |
workflow_dispatch: | |
jobs: | |
test-var-persistence: | |
runs-on: ubuntu-latest | |
environment: pipeline-env | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get image root | |
run: | | |
echo "${{ vars.IMG_ROOT }}" | |
deploy-base: | |
runs-on: ubuntu-latest | |
needs: test-var-persistence | |
environment: pipeline-env | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to GHCR | |
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin | |
- name: Create gcloud config | |
run: | | |
echo "$BIOSIMULATIONS_GCLOUD_CONFIG" > ./assets/docker/config/.biosimulations.json | |
env: | |
BIOSIMULATIONS_GCLOUD_CONFIG: ${{ secrets.BIO_JSON_CONTENT }} | |
- name: Deploy Base image | |
run: | | |
BASE_VERSION=$(cat ./assets/docker/.BASE_VERSION) | |
BASE_IMG="${{ vars.IMG_ROOT }}-base:$BASE_VERSION" | |
docker build --no-cache -f ./Dockerfile -t $BASE_IMG . | |
docker push $BASE_IMG | |
LATEST_IMG="${{ vars.IMG_ROOT }}-base:latest" | |
docker tag $BASE_IMG $LATEST_IMG | |
docker push $LATEST_IMG | |
deploy-gateway: | |
needs: deploy-base | |
runs-on: ubuntu-latest | |
environment: pipeline-env | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to GHCR | |
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin | |
- name: Build gateway service | |
run: | | |
GATEWAY_VERSION=$(python -B .github/parse_container_version.py gateway) | |
GATEWAY_IMG="${{ vars.IMG_ROOT }}-gateway:$GATEWAY_VERSION" | |
docker build --no-cache -f ./gateway/Dockerfile-gateway -t $GATEWAY_IMG . | |
docker push $GATEWAY_IMG | |
LATEST_IMG="${{ vars.IMG_ROOT }}-gateway:latest" | |
docker tag $GATEWAY_IMG $LATEST_IMG | |
docker push $LATEST_IMG | |
deploy-worker: | |
needs: deploy-gateway | |
runs-on: ubuntu-latest | |
environment: pipeline-env | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to GHCR | |
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin | |
- name: Build worker service | |
run: | | |
WORKER_VERSION=$(python -B .github/parse_container_version.py worker) | |
WORKER_IMG="${{ vars.IMG_ROOT }}-worker:$WORKER_VERSION" | |
docker build --no-cache -f ./worker/Dockerfile-worker -t $WORKER_IMG . | |
docker push $WORKER_IMG | |
LATEST_IMG="${{ vars.IMG_ROOT }}-worker:latest" | |
docker tag $WORKER_IMG $LATEST_IMG | |
docker push $LATEST_IMG | |