2020-07-16 19:56:35 +00:00
|
|
|
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
|
|
|
|
|
2020-10-13 14:32:41 +00:00
|
|
|
- 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
|
2020-07-16 19:56:35 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2020-10-13 14:32:41 +00:00
|
|
|
|
|
|
|
- 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 }}
|