Improved the auto-build for the Docker image

master
Marcus Bakker 2021-03-02 07:21:04 +01:00
parent c78e6b35a2
commit 3d20d18bd3
5 changed files with 70 additions and 90 deletions

View File

@ -0,0 +1,55 @@
name: Build Docker image
on:
schedule:
- cron: '0 3 * * 0'
push:
branches: [ master ]
paths-ignore:
- '.github/workflows/**'
workflow_dispatch:
inputs:
version_tag:
description: 'Format: v[version number]'
required: true
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
with:
fetch-depth: 0
# scheduled run + on push
- name: Schedule + push - get the latest version tag
if: github.event_name == 'schedule' || github.event_name == 'push'
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Schedule + push - create version tag
if: github.event_name == 'schedule' || github.event_name == 'push'
run: |
TAG="rabobankcdc/dettect:${{ steps.previoustag.outputs.tag }}"
echo "version_tag=${TAG}" >> $GITHUB_ENV
# manual run
- name: Manual - create version tag
if: github.event_name == 'workflow_dispatch'
run: echo "version_tag=rabobankcdc/dettect:${{ github.event.inputs.version_tag }}" >> $GITHUB_ENV
- 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, ${{ env.version_tag }}

View File

@ -1,43 +0,0 @@
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 }}

View File

@ -1,30 +0,0 @@
name: Build Docker image - manual
on:
workflow_dispatch:
inputs:
version_tag:
description: 'Format: v[version number]'
required: true
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: 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, rabobankcdc/dettect:${{ github.event.inputs.version_tag }}

View File

@ -1,6 +1,5 @@
name: Refresh Editor ATT&CK data
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:

View File

@ -1,6 +1,5 @@
name: Update Wiki Help texts
on:
workflow_dispatch:
push:
branches: [ master ]
paths: