Skip to content

Merge pull request #567 from CodeForPhilly/deploy_test #23

Merge pull request #567 from CodeForPhilly/deploy_test

Merge pull request #567 from CodeForPhilly/deploy_test #23

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}"