From e44c7cac813752c570b9354660843b08bd3e2a15 Mon Sep 17 00:00:00 2001 From: Vishal Vaibhav Date: Thu, 21 May 2026 20:02:30 +0530 Subject: [PATCH] feat: ghcr Signed-off-by: Vishal Vaibhav --- .github/workflows/release.yml | 19 ++++++++++++++----- README.md | 19 +++++++++++++++++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5457b6..b63e6ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,14 @@ on: release: types: [created] +permissions: + contents: read + packages: write # required to push the image to GHCR + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} # ghcr.io/target/pull-request-code-coverage + jobs: docker: environment: deployment @@ -11,16 +19,17 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v4 - - name: Docker Login + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # built-in token, no extra secrets needed - name: Docker Build and Push id: docker_build uses: docker/build-push-action@v6 with: push: true tags: | - ${{ secrets.DOCKER_REPO }}/pull-request-code-coverage:latest - ${{ secrets.DOCKER_REPO }}/pull-request-code-coverage:${{ github.event.release.tag_name }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} diff --git a/README.md b/README.md index 75e11cd..8bd547a 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ Currently, this plugin supports two coverage file format. This plugin works out of box for [Vela](https://github.com/go-vela),a CI/CD open-sourced by target +## Docker image + +The plugin is published as a public Docker image to the GitHub Container Registry (GHCR) on every release: + +``` +ghcr.io/target/pull-request-code-coverage:latest +ghcr.io/target/pull-request-code-coverage: +``` + +Pull it with: + +``` +docker pull ghcr.io/target/pull-request-code-coverage:latest +``` + ## VELA Usage ### Jvm based projects @@ -31,7 +46,7 @@ this project. Once you have that jacoco file, you can pass that path to coverage ```yaml - name: check-pr-code-coverage - image: docker.target.com/app/pull-request-code-coverage + image: ghcr.io/target/pull-request-code-coverage:latest pull: true ruleset: event: [pull_request] @@ -65,7 +80,7 @@ Once you have coverage.xml same can be passed as an input to plugin shown below ```yaml - name: check-pr-code-coverage - image: docker.target.com/app/pull-request-code-coverage + image: ghcr.io/target/pull-request-code-coverage:latest pull: true ruleset: event: [pull_request]