Skip to content

Commit e6006e4

Browse files
Merge pull request #36 from CodeForPhilly/develop
Release: v0.1.1
2 parents 249afd8 + 8261f1c commit e6006e4

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 'Containers: Publish'
2+
3+
on:
4+
push:
5+
tags: [ 'v*' ]
6+
7+
8+
jobs:
9+
release-containers:
10+
name: Build and Push
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- uses: actions/checkout@v3
15+
16+
- name: Login to ghcr.io Docker registry
17+
uses: docker/login-action@v2
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.repository_owner }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Compute Docker container image addresses
24+
run: |
25+
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}"
26+
DOCKER_TAG="${GITHUB_REF:11}"
27+
28+
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV
29+
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
30+
31+
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}"
32+
33+
- name: 'Pull previous Docker container image: :latest'
34+
run: docker pull "${DOCKER_REPOSITORY}:latest" || true
35+
36+
- name: 'Pull previous Docker container image: frontend:latest'
37+
run: docker pull "${DOCKER_REPOSITORY}/frontend:latest" || true
38+
39+
- name: 'Build Docker container image: :latest'
40+
run: |
41+
docker build \
42+
--cache-from "${DOCKER_REPOSITORY}:latest" \
43+
--tag "${DOCKER_REPOSITORY}:latest" \
44+
--tag "${DOCKER_REPOSITORY}:${DOCKER_TAG}" \
45+
src/django
46+
47+
- name: 'Build Docker container image: frontend:latest'
48+
run: |
49+
docker build \
50+
--target runtime \
51+
--cache-from "${DOCKER_REPOSITORY}/frontend:latest" \
52+
--tag "${DOCKER_REPOSITORY}/frontend:latest" \
53+
--tag "${DOCKER_REPOSITORY}/frontend:${DOCKER_TAG}" \
54+
src/app
55+
56+
- name: Push Docker container image frontend:latest"
57+
run: docker push "${DOCKER_REPOSITORY}/frontend:latest"
58+
59+
- name: Push Docker container image frontend:v*"
60+
run: docker push "${DOCKER_REPOSITORY}/frontend:${DOCKER_TAG}"
61+
62+
- name: Push Docker container image :latest"
63+
run: docker push "${DOCKER_REPOSITORY}:latest"
64+
65+
- name: Push Docker container image :v*"
66+
run: docker push "${DOCKER_REPOSITORY}:${DOCKER_TAG}"

0 commit comments

Comments
 (0)