Skip to content

Commit 4a48c6d

Browse files
author
Dan Kelley
committed
first test on workflow
1 parent dca3811 commit 4a48c6d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release Containers
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@v2
15+
16+
- name: Login to ghcr.io Docker registry
17+
uses: docker/login-action@v1
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+
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV
28+
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
29+
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}"
30+
- name: 'Pull latest existing Docker container image: server'
31+
run: docker pull "${DOCKER_REPOSITORY}/server:latest" || true
32+
33+
- name: 'Build Docker container image: server'
34+
run: |
35+
docker build \
36+
--cache-from "${DOCKER_REPOSITORY}/server:latest" \
37+
--tag "${DOCKER_REPOSITORY}/server:latest" \
38+
--tag "${DOCKER_REPOSITORY}/server:${DOCKER_TAG}" \
39+
.
40+
41+
- name: Push Docker container image server:latest"
42+
run: docker push "${DOCKER_REPOSITORY}/server:latest"
43+
44+
- name: Push Docker container image server:v*"
45+
run: docker push "${DOCKER_REPOSITORY}/server:${DOCKER_TAG}"

0 commit comments

Comments
 (0)