Update digests and trigger build if required #50
This file contains 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: Update digests and trigger build if required | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "5 4 */5 * *" | |
permissions: | |
packages: write | |
contents: write | |
pull-requests: write | |
jobs: | |
update_file: | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.update.outputs.changed }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: update digests | |
id: update | |
run: | | |
podman manifest inspect registry.fedoraproject.org/fedora:39 | jq -r '.manifests | .[] | select(.platform.architecture == "arm64" or .platform.architecture == "amd64") | "digest_\(.platform.architecture)=\(.digest)"' | sort > images/fedbox/builddigests | |
git diff --exit-code images/fedbox/builddigests && echo "changed=false" >> $GITHUB_OUTPUT || echo "changed=true" >> $GITHUB_OUTPUT | |
- name: Commit and push if changed | |
if: steps.update.outputs.changed == 'true' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add images/fedbox/builddigests | |
git commit -m "update digests to latest version" | |
git push | |
build: | |
needs: update_file | |
if: needs.update_file.outputs.changed == 'true' | |
uses: ./.github/workflows/buildah-fedbox.yml |