-
Notifications
You must be signed in to change notification settings - Fork 9
63 lines (49 loc) · 2.03 KB
/
release-containers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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}"