* github-ci: color unit test output and logs * new config option: force_color_logs (useful in CI) * bats: show sqlite/mysql dump at the end * removed "-v" (print package names) from "go build" * general workflow cleanup
63 lines
2 KiB
YAML
63 lines
2 KiB
YAML
name: Publish Docker Debian image
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- released
|
|
- prereleased
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
push_to_registry:
|
|
name: Push Docker debian image to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Prepare
|
|
id: prep
|
|
run: |
|
|
DOCKER_IMAGE=crowdsecurity/crowdsec
|
|
VERSION=bullseye
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -E 's#/+#-#g')
|
|
elif [[ $GITHUB_REF == refs/pull/* ]]; then
|
|
VERSION=pr-${{ github.event.number }}
|
|
fi
|
|
TAGS="${DOCKER_IMAGE}:${VERSION}-debian"
|
|
if [[ ${{ github.event.action }} == released ]]; then
|
|
TAGS=$TAGS,${DOCKER_IMAGE}:latest-debian
|
|
fi
|
|
echo ::set-output name=version::${VERSION}
|
|
echo ::set-output name=tags::${TAGS}
|
|
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
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
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.debian
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386
|
|
labels: |
|
|
org.opencontainers.image.source=${{ github.event.repository.html_url }}
|
|
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
|
|
org.opencontainers.image.revision=${{ github.sha }}
|