Skip to content

Workflow file for this run

name: Release PR image
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
get-pr-number:
name: Get PR number
runs-on: ubuntu-latest
outputs:
pr-number: ${{ steps.pr_number.outputs.pr_number }}
steps:
- name: 'Download artifacts'
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip pr_number.zip
- name: 'Read PR number'
id: pr_number
run: |
echo "pr_number=$(cat pr_number)" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs:
- get-pr-number
permissions:
contents: read
id-token: write
packages: write
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/ppc64le
- linux/s390x
steps:
- name: openscap-container-push-pr
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main
with:
name: openscap-ocp
registry_org: complianceascode
tag: ${{ needs.get-pr-number.outputs.pr-number }}
dockerfile_path: images/openscap/Dockerfile
vendor: 'Compliance Operator Authors'
checkout_ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head
platforms: ${{ matrix.platform }}
- name: operator-container-push-pr
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main
with:
name: compliance-operator
registry_org: complianceascode
tag: ${{ needs.get-pr-number.outputs.pr-number }}
dockerfile_path: build/Dockerfile
vendor: 'Compliance Operator Authors'
checkout_ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head
platforms: ${{ matrix.platform }}
- name: bundle-container-push-pr
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main
with:
name: compliance-operator-bundle
registry_org: complianceascode
tag: ${{ needs.get-pr-number.outputs.pr-number }}
dockerfile_path: bundle.Dockerfile
vendor: 'Compliance Operator Authors'
checkout_ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head
platforms: ${{ matrix.platform }}
- name: catalog-container-push-pr
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main
with:
name: compliance-operator-catalog
registry_org: complianceascode
tag: ${{ needs.get-pr-number.outputs.pr-number }}
dockerfile_path: catalog.Dockerfile
vendor: 'Compliance Operator Authors'
checkout_ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head
prepare_command: |
make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:${{ needs.get-pr-number.outputs.pr-number }}
platforms: ${{ matrix.platform }}
comment-pr:
needs:
- build
runs-on: ubuntu-latest
name: Comment on the PR
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:robot: To deploy this PR, run the following command:
```
make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:${{ needs.get-pr-number.outputs.pr-number }}
```