Merge pull request #567 from CodeForPhilly/deploy_test #23
Workflow file for this run
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: Release Containers | |
on: | |
push: | |
tags: [ 'v*' ] | |
jobs: | |
release-containers: | |
name: Build and Push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to ghcr.io Docker registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compute Docker container image addresses | |
run: | | |
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}" | |
DOCKER_TAG="${GITHUB_REF:11}" | |
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV | |
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV | |
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}" | |
- name: 'Pull latest existing Docker container image: server' | |
run: docker pull "${DOCKER_REPOSITORY}/server:latest" || true | |
- name: 'Pull latest existing Docker container image: client' | |
run: docker pull "${DOCKER_REPOSITORY}/client:latest" || true | |
- name: 'Build Docker container image: server' | |
run: | | |
docker build \ | |
--cache-from "${DOCKER_REPOSITORY}/server:latest" \ | |
--tag "${DOCKER_REPOSITORY}/server:latest" \ | |
--tag "${DOCKER_REPOSITORY}/server:${DOCKER_TAG}" \ | |
./src/server | |
- name: Push Docker container image server:latest" | |
run: docker push "${DOCKER_REPOSITORY}/server:latest" | |
- name: Push Docker container image server:v*" | |
run: docker push "${DOCKER_REPOSITORY}/server:${DOCKER_TAG}" | |
- name: 'Build Docker container image: client' | |
run: | | |
docker build \ | |
--cache-from "${DOCKER_REPOSITORY}/client:latest" \ | |
--tag "${DOCKER_REPOSITORY}/client:latest" \ | |
--tag "${DOCKER_REPOSITORY}/client:${DOCKER_TAG}" \ | |
./src/client | |
- name: Push Docker container image client:latest" | |
run: docker push "${DOCKER_REPOSITORY}/client:latest" | |
- name: Push Docker container image client:v*" | |
run: docker push "${DOCKER_REPOSITORY}/client:${DOCKER_TAG}" |