Skip to content

Docker Build

Docker Build #26

Workflow file for this run

name: Docker Build
on:
pull_request:
branches: [main]
types: [closed]
workflow_dispatch:
jobs:
docker:
name: Build & Push Docker Image
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Generate Docker tags
id: tags
run: |
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
SAFE_BRANCH="$(echo "$BRANCH" | tr '/' '-')"
VERSION_TAG="$(date +'%d-%m-%Y')-${SAFE_BRANCH}"
TAGS="docker.io/woss/woss-io:${VERSION_TAG}"
if [ "$BRANCH" = "main" ]; then
TAGS="${TAGS}\ndocker.io/woss/woss-io:latest"
fi
echo "tags<<EOF
${TAGS}
EOF" >> $GITHUB_OUTPUT
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v7
with:
push: true
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: ${{ steps.tags.outputs.tags }}