Skip to content

v1.6.1

v1.6.1 #5

name: Publish Docker Image to Docker Hub
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Docker tag to publish (required). Must match vX.Y.Z'
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Docker tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
DOCKER_TAG="${{ github.event.inputs.tag }}"
else
DOCKER_TAG="${{ github.event.release.tag_name }}"
fi
# Convert to lowercase and remove spaces
DOCKER_TAG=$(echo "$DOCKER_TAG" | tr '[:upper:]' '[:lower:]' | tr -d ' ')
# Validate format (eg: v1.2.3)
if [[ ! "$DOCKER_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Docker tag '$DOCKER_TAG' is invalid. Must match vX.Y.Z"
exit 1
fi
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
echo "Docker tag will be: $DOCKER_TAG"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
internxt/webdav:latest
internxt/webdav:${{ env.DOCKER_TAG }}