Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
internxt/webdav:latest
internxt/webdav:${{ env.DOCKER_TAG }}

- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: internxt/webdav
short-description: Official WebDAV server for Internxt
readme-filepath: ./docker/README.md
enable-url-completion: true