-
Notifications
You must be signed in to change notification settings - Fork 26
51 lines (48 loc) · 1.48 KB
/
publish-docker-image.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
name: Publish Docker image
on:
push:
branches:
- master
- int
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'dev'
type: choice
options:
- dev
env:
TAG: ${{ inputs.tag }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Login
uses: docker/login-action@v2.1.0
with:
# Username used to log against the Docker registry
username: ${{ secrets.DOCKER_USER }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.DOCKER_PASS }}
- name: Determine image tag
run: |
: "${TAG:=$(date +"%Y.%U.%u")}"
[[ "$BRANCH_NAME" == "int" ]] && TAG=int
echo "TAG=$TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build Docker image
run: docker build . --file ./setup/Dockerfile --tag devonfwforge/hangar:$TAG
- name: Push Docker image
run: docker push devonfwforge/hangar:$TAG
- name: Push other tags
run: |
if [[ "$TAG" == "$(date +"%Y.%U.%u")" ]]; then
docker tag devonfwforge/hangar:$TAG devonfwforge/hangar:$(date +"%Y.%U")
docker tag devonfwforge/hangar:$TAG devonfwforge/hangar:latest
docker push devonfwforge/hangar:$(date +"%Y.%U")
docker push devonfwforge/hangar:latest
fi