diff --git a/.github/workflows/k8s-content-pr.yaml b/.github/workflows/k8s-content-pr.yaml index 313fb3001b91..5c717ae161a6 100644 --- a/.github/workflows/k8s-content-pr.yaml +++ b/.github/workflows/k8s-content-pr.yaml @@ -47,21 +47,54 @@ jobs: id-token: write packages: write runs-on: ubuntu-latest + outputs: + image-digest: ${{ steps.container_info.outputs.image-digest }} + image-tags: ${{ steps.container_info.outputs.image-tags }} steps: - - name: Checkout PR branch + - name: Checkout uses: actions/checkout@v4 with: ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head - - name: Build and push container image - uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main + - name: Login to ghcr.io + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Docker metadata + id: meta + uses: docker/metadata-action@v4 with: - name: k8scontent - tag: ${{ needs.get-pr-number.outputs.pr-number }} - latest: false - registry_org: complianceascode - dockerfile_path: ./Dockerfiles/ocp4_content - licenses: BSD - vendor: ComplianceAsCode authors + images: ghcr.io/complianceascode/k8scontent + tags: | + type=raw,value=${{ needs.get-pr-number.outputs.pr-number }} + type=sha,format=long + labels: | + org.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} + org.opencontainers.image.title=Kubernetes content + org.opencontainers.image.version=${{ needs.get-pr-number.outputs.pr-number }} + org.opencontainers.image.licenses='Apache-2.0' + org.opencontainers.image.vendor='Compliance Operator Authors' + - name: Build container images and push + id: docker_build + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfiles/ocp4_content + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + platforms: 'linux/amd64' + - name: Get container info + id: container_info + run: | + image_tags="${{ needs.get-pr-number.outputs.pr-number }}" + echo "::set-output name=image-digest::${{ steps.docker_build.outputs.digest }}" + echo "::set-output name=image-tags::${image_tags}" comment-pr: needs: