name: Publish image # Build and push the feeder image to the GitHub Container Registry (ghcr.io): # * every push to main -> the moving `main` tag # * every `v*` tag -> semver tags (e.g. v1.0.0 -> 1.0.0, 1.0, 1) # The build context is the repo root (the workspace) so the vendored # `meta-feeder-sdk` path dependency resolves; the Dockerfile lives under # feeder-plugin/paper-feeder/. on: push: branches: [main] tags: ['v*'] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: publish: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract image metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=semver,pattern={{version}} # A fix to release 1.2.3 is tagged v1.2.3.1: four numbers are not semver, so # the pattern above makes no tag for it; this one does (image tag 1.2.3.1). type=match,pattern=v(\d+\.\d+\.\d+\.\d+),group=1 type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha,format=short - name: Build and push uses: docker/build-push-action@v6 with: context: . file: ./feeder-plugin/europepmc-feeder/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max