release-okd #163
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: release-okd | |
| # Workflow to build and release OKD container images | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| ushift-gitref: | |
| default: "main" | |
| description: MicroShift git ref (branch, tag, commit) from https://github.com/openshift/microshift/branches | |
| type: string | |
| okd-version-tag: | |
| default: "latest" | |
| description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags | |
| type: string | |
| okd-target-registry: | |
| default: "ghcr.io/microshift-io/okd" | |
| description: Target registry for the OKD release images for ARM | |
| type: string | |
| # The workflow dispatch inputs are not inherited by the scheduled workflow runs. | |
| # Use environment variables to pass the inputs to the build action. | |
| env: | |
| USHIFT_GITREF: ${{ github.event.inputs.ushift-gitref || 'main' }} | |
| OKD_VERSION_TAG: ${{ github.event.inputs.okd-version-tag || 'latest' }} | |
| OKD_TARGET_REGISTRY: ${{ github.event.inputs.okd-target-registry || 'ghcr.io/microshift-io/okd' }} | |
| jobs: | |
| build-okd-release: | |
| name: Build OKD release images for ARM | |
| if: github.event_name != 'schedule' || github.repository == 'microshift-io/microshift' | |
| runs-on: ubuntu-24.04-arm | |
| # Export the detected OKD version as a job output so the cleanup job can use | |
| # the same version. This prevents version mismatches if the build fails before | |
| # version detection completes. | |
| outputs: | |
| okd-version-tag: ${{ steps.set-version.outputs.okd-version-tag }} | |
| steps: | |
| - name: Check out MicroShift upstream repository | |
| uses: actions/checkout@v4 | |
| # Always get the latest available 'amd64' OKD version tag and attempt | |
| # to build 'arm64' images for it | |
| - name: Detect OKD version tag | |
| id: detect-okd-version | |
| uses: ./.github/actions/okd-version | |
| with: | |
| check-amd64: "true" | |
| # Determine which OKD version to use (user-specified OR auto-detected) and | |
| # capture it as a step output so it can be exported as a job output. | |
| # This ensures the cleanup job uses the exact same version as the build job, | |
| # preventing cleanup from targeting wrong staging images. | |
| - name: Set OKD version for reuse | |
| id: set-version | |
| run: | | |
| VERSION="${{ env.OKD_VERSION_TAG != 'latest' && env.OKD_VERSION_TAG || steps.detect-okd-version.outputs.okd-version-tag }}" | |
| echo "okd-version-tag=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Using OKD version: ${VERSION}" | |
| - name: Run the OKD release images build action | |
| uses: ./.github/actions/build-okd | |
| with: | |
| ushift-gitref: ${{ env.USHIFT_GITREF }} | |
| okd-version-tag: ${{ steps.set-version.outputs.okd-version-tag }} | |
| target-arch: arm64 | |
| target-registry: ${{ env.OKD_TARGET_REGISTRY }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| cleanup-staging: | |
| name: Cleanup staging registry | |
| needs: build-okd-release | |
| if: (success() || failure()) && needs.build-okd-release.outputs.okd-version-tag != '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out MicroShift upstream repository | |
| uses: actions/checkout@v4 | |
| - name: Run cleanup of staging OKD images | |
| uses: ./.github/actions/cleanup-okd | |
| with: | |
| okd-version-tag: ${{ needs.build-okd-release.outputs.okd-version-tag }} | |
| token: ${{ secrets.GITHUB_TOKEN }} |