refactor: rename root directories to tasks and runner #687
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Images | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| env: | |
| REGISTRY: quay.io | |
| IMAGE_BASE: quay.io/rcochran/openshell | |
| jobs: | |
| sandbox: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - profile: sandbox-default | |
| tag_prefix: sandbox | |
| platforms: linux/amd64,linux/arm64 | |
| - profile: sandbox-stackrox-ci | |
| tag_prefix: sandbox-stackrox-ci | |
| platforms: linux/amd64 | |
| - profile: sandbox-collector-builder | |
| tag_prefix: sandbox-collector-builder | |
| platforms: linux/amd64 | |
| env: | |
| IMAGE_PROFILE: ${{ matrix.profile }} | |
| IMAGE_TAG_PREFIX: ${{ matrix.tag_prefix }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check image inputs | |
| id: changes | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} | |
| run: | | |
| if [[ "$GITHUB_REF_TYPE" == tag || -z "$BASE_SHA" || "$BASE_SHA" =~ ^0+$ ]]; then | |
| changed=true | |
| elif git diff --quiet "$BASE_SHA" HEAD -- "images/stackrox/${IMAGE_PROFILE}" .github/workflows/images.yml; then | |
| changed=false | |
| else | |
| changed=true | |
| fi | |
| echo "changed=$changed" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-qemu-action@v4 | |
| if: steps.changes.outputs.changed == 'true' | |
| - uses: docker/setup-buildx-action@v3 | |
| if: steps.changes.outputs.changed == 'true' | |
| - uses: docker/login-action@v4 | |
| if: steps.changes.outputs.changed == 'true' && github.event_name == 'push' | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.REGISTRY_QUAY_USER }} | |
| password: ${{ secrets.REGISTRY_QUAY_PASSWORD }} | |
| - name: Compute version tag | |
| id: version | |
| if: steps.changes.outputs.changed == 'true' | |
| run: echo "version=$(git describe --tags --always 2>/dev/null || echo dev)" >> "$GITHUB_OUTPUT" | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| if: steps.changes.outputs.changed == 'true' | |
| with: | |
| images: ${{ env.IMAGE_BASE }} | |
| tags: | | |
| type=semver,pattern=${{ env.IMAGE_TAG_PREFIX }}-v{{version}} | |
| type=raw,value=${{ env.IMAGE_TAG_PREFIX }}-${{ steps.version.outputs.version }},enable=${{ github.ref_type != 'tag' }} | |
| - uses: docker/build-push-action@v6 | |
| if: steps.changes.outputs.changed == 'true' | |
| with: | |
| context: images/stackrox/${{ matrix.profile }} | |
| platforms: ${{ matrix.platforms }} | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=registry,ref=${{ env.IMAGE_BASE }}:${{ env.IMAGE_TAG_PREFIX }}-cache | |
| cache-to: ${{ github.event_name == 'push' && format('type=registry,ref={0}:{1}-cache,mode=max', env.IMAGE_BASE, env.IMAGE_TAG_PREFIX) || '' }} |