name: Publish Docker Image on: push: tags: - 'v*' env: IMAGE_NAME: webdecoy/fcaptcha jobs: build-and-push: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: ref: ${{ github.ref }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 - name: Log in to GHCR uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract version from tag id: version env: REF_TYPE: ${{ github.ref_type }} REF_NAME: ${{ github.ref_name }} run: | TAGS="ghcr.io/${IMAGE_NAME}:latest" if [[ "$REF_TYPE" == "tag" ]]; then VERSION="${REF_NAME#v}" TAGS="${TAGS},ghcr.io/${IMAGE_NAME}:${VERSION}" fi echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" echo "revision=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - name: Build and push uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7 with: context: . file: docker/Dockerfile push: true provenance: mode=max sbom: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.version.outputs.tags }} # Artifact Hub reads package metadata from the multi-platform image index. annotations: | index:io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.version.outputs.revision }}/docker/README.md index:org.opencontainers.image.created=${{ steps.version.outputs.created }} index:org.opencontainers.image.description=Self-hosted CAPTCHA with a browser widget and server-side token verification index:org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} index:io.artifacthub.package.license=MIT cache-from: type=gha cache-to: type=gha,mode=max