44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
name: Build Docker image - on release
|
|
on:
|
|
release:
|
|
types:
|
|
- created
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Prepare
|
|
id: prep
|
|
run: |
|
|
DOCKER_IMAGE=rabobankcdc/dettect
|
|
VERSION=edge
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
|
|
elif [[ $GITHUB_REF == refs/pull/* ]]; then
|
|
VERSION=pr-${{ github.event.number }}
|
|
fi
|
|
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
|
echo ::set-output name=tags::${TAGS}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push Docker images
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
pull: true
|
|
push: true
|
|
tags: rabobankcdc/dettect:latest, ${{ steps.prep.outputs.tags }}
|