Skip to content

Merge pull request #555 from victordrose/feature/azure-ci-pipeline #90

Merge pull request #555 from victordrose/feature/azure-ci-pipeline

Merge pull request #555 from victordrose/feature/azure-ci-pipeline #90

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/[email protected]
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