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 - name: Trigger Dokploy deployment if: github.ref == 'refs/heads/main' run: | set -eu if [ -z "${{ secrets.DOKPLOY_WEBHOOK_URL }}" ]; then echo "::error::Set the DOKPLOY_WEBHOOK_URL repository secret." exit 1 fi curl -fsS -X POST "${{ secrets.DOKPLOY_WEBHOOK_URL }}"