From 62f1ea5d361527d6ce85328286b39ba62f09b364 Mon Sep 17 00:00:00 2001 From: Sergey Filkin Date: Thu, 30 Apr 2026 16:21:56 +0300 Subject: [PATCH] Add Gitea Docker build workflow --- .gitea/workflows/docker.yml | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .gitea/workflows/docker.yml diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..dff1b7f --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,75 @@ +name: Docker + +on: + push: + branches: + - main + tags: + - "v*" + workflow_dispatch: + +env: + IMAGE_NAME: fsadmin/md-to-html + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare tags + id: meta + shell: sh + run: | + set -eu + + if [ -z "${{ vars.REGISTRY }}" ]; then + echo "::error::Set the REGISTRY repository variable to your Gitea registry host." + exit 1 + fi + + image="${{ vars.REGISTRY }}/${IMAGE_NAME}" + short_sha="$(printf '%s' "${GITHUB_SHA}" | cut -c1-12)" + + { + echo "image=${image}" + echo "tags<> "${GITHUB_OUTPUT}" + + - name: Login to registry + run: | + printf '%s' "${{ secrets.REGISTRY_PASSWORD }}" \ + | docker login "${{ vars.REGISTRY }}" \ + --username "${{ secrets.REGISTRY_USERNAME }}" \ + --password-stdin + + - name: Build and push image + env: + DOCKER_BUILDKIT: "1" + run: | + set -eu + + tags="" + while IFS= read -r tag; do + tags="${tags} -t ${tag}" + done <<'EOF' + ${{ steps.meta.outputs.tags }} + EOF + + docker build ${tags} . + + while IFS= read -r tag; do + docker push "${tag}" + done <<'EOF' + ${{ steps.meta.outputs.tags }} + EOF