name: Publish PR builds on: workflow_run: workflows: ["build-ublue"] types: - completed env: IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} jobs: upload: runs-on: ubuntu-latest if: > github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' steps: - name: 'Download artifact' uses: actions/github-script@v3.1.0 with: script: | var artifacts = await github.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: ${{github.event.workflow_run.id }}, }); var matchArtifact = artifacts.data.artifacts.filter((artifact) => { return artifact.name == "output" })[0]; var download = await github.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, artifact_id: matchArtifact.id, archive_format: 'zip', }); var fs = require('fs'); fs.writeFileSync('${{github.workspace}}/output.zip', Buffer.from(download.data)); - run: unzip output.zip - name: Load Container Image id: load_image run: | ls -lah cat image cat tags podman load -i image.tar image_name="localhost/$(head -n1 image):$(head -n1 tags)" for t in $(cat tags); do podman tag $image_name $(head -n1 image):$t done echo image="$(cat image)" >> $GITHUB_OUTPUT delimiter="$(openssl rand -hex 8)" { echo "tags<<${delimiter}" cat tags echo "${delimiter}" } >> $GITHUB_OUTPUT - name: Lowercase Registry id: registry_case uses: ASzc/change-string-case-action@v5 with: string: ${{ env.IMAGE_REGISTRY }} - name: Push To GHCR uses: redhat-actions/push-to-registry@v2 id: push if: github.event_name != 'pull_request' env: REGISTRY_USER: ${{ github.actor }} REGISTRY_PASSWORD: ${{ github.token }} with: image: ${{ steps.load_image.outputs.image }} tags: ${{ steps.load_image.outputs.tags }} registry: ${{ steps.registry_case.outputs.lowercase }} username: ${{ env.REGISTRY_USER }} password: ${{ env.REGISTRY_PASSWORD }} extra-args: | --disable-content-trust