diff --git a/.github/workflows/maybe-build-yaucore.yaml b/.github/workflows/maybe-build-yaucore.yaml index 3904b56..bd5ee69 100644 --- a/.github/workflows/maybe-build-yaucore.yaml +++ b/.github/workflows/maybe-build-yaucore.yaml @@ -15,6 +15,5 @@ jobs: SIGNING_SECRET: ${{ secrets.SIGNING_SECRET }} uses: ./.github/workflows/maybe-build.yaml with: - base: ublue-os/ucore-hci:stable - derivative: yacoob/yaucore:latest + image: yacoob/yaucore:latest recipe: yaucore.yaml diff --git a/.github/workflows/maybe-build-yaurora.yaml b/.github/workflows/maybe-build-yaurora.yaml index 7237255..7544345 100644 --- a/.github/workflows/maybe-build-yaurora.yaml +++ b/.github/workflows/maybe-build-yaurora.yaml @@ -15,6 +15,5 @@ jobs: SIGNING_SECRET: ${{ secrets.SIGNING_SECRET }} uses: ./.github/workflows/maybe-build.yaml with: - base: ublue-os/aurora-dx:stable - derivative: yacoob/yaurora:latest + image: yacoob/yaurora:latest recipe: yaurora.yaml diff --git a/.github/workflows/maybe-build.yaml b/.github/workflows/maybe-build.yaml index 7120851..ed132f7 100644 --- a/.github/workflows/maybe-build.yaml +++ b/.github/workflows/maybe-build.yaml @@ -2,49 +2,36 @@ name: Check if we need to build a new image due to the base image update on: workflow_call: inputs: - base: - description: Base image (user/name:tag) to check for updates - required: true - type: string - derivative: - description: My image (user/name:tag) to compare against + image: + description: Image (user/name:tag) to check required: true type: string recipe: description: Recipe file to use for the build required: true type: string + secrets: + SIGNING_SECRET: + required: true jobs: check: name: Check if there's a new version of the base image runs-on: ubuntu-latest outputs: - needs_rebuild: ${{ steps.maybe-build.conclusion == 'success' }} + needs_rebuild: ${{ steps.compare.outputs.verdict == 'true' }} steps: - - name: Get SHA of the latest ${{ inputs.base }} present in the repository - id: registry - run: | - REGISTRY_SHA=$(skopeo inspect docker://ghcr.io/${{ inputs.base }} | jq '.Digest' ) - echo "SHA=$REGISTRY_SHA" >> $GITHUB_OUTPUT - - - name: Get SHA of the latest ${{ inputs.derivative }} present in the repository - id: last-build - run: | - LAST_BUILD_SHA=$(skopeo inspect docker://ghcr.io/${{ inputs.derivative }} | jq '.Labels."org.opencontainers.image.base.digest"') - echo "SHA=$LAST_BUILD_SHA" >> $GITHUB_OUTPUT - - - name: Output gathered information - id: debug-output - run: | - echo "${{ inputs.base }} is currently at [${{ steps.registry.outputs.SHA }}]" - echo "${{ inputs.derivative }} has last been built at ${{ inputs.base }}'s: [${{ steps.last-build.outputs.SHA }}]" - - - name: Decide that we need a new build - id: maybe-build - if: steps.last-build.outputs.SHA != steps.registry.outputs.SHA + - name: Interrogate docker repository about ${{ inputs.image }} + id: compare run: | - echo "Verdict: ${{ inputs.derivative }} needs to be rebuilt" + LATEST_BUILD_BASE_SHA=$(skopeo inspect docker://ghcr.io/${{ inputs.image }} | jq -r '.Labels."org.opencontainers.image.base.digest"') + BASE_IMAGE=$(skopeo inspect docker://ghcr.io/${{ inputs.image }} | jq -r '.Labels."org.opencontainers.image.base.name"') + LATEST_BASE_SHA=$(skopeo inspect docker://${BASE_IMAGE} | jq -r '.Digest' ) + echo "Digest of ${BASE_IMAGE} from which latest ${{ inputs.image }} was built: [${LATEST_BUILD_BASE_SHA}]" >> ${GITHUB_OUTPUT} + echo "${BASE_IMAGE} is currently at [${LATEST_BASE_SHA}]" >> ${GITHUB_OUTPUT} + VERDICT=$([ "${LATEST_BUILD_BASE_SHA}" != "${LATEST_BASE_SHA}" ] && echo "true" || echo "false") + echo "## Rebuild needed: ${VERDICT}" >> ${GITHUB_STEP_SUMMARY} + echo "verdict=${VERDICT}" >> ${GITHUB_OUTPUT} build: permissions: