generated from blue-build/template
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (51 loc) · 1.89 KB
/
maybe_build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Check if we need to build a new image due to base image update
on:
schedule:
- cron: "30 * * * *"
workflow_dispatch:
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' }}
steps:
- name: Get SHA of the latest base image present in the repository
id: registry
run: |
REGISTRY_SHA=$(skopeo inspect --format '{{ .Digest }}' docker://ghcr.io/ublue-os/aurora-dx:stable )
echo "SHA=$REGISTRY_SHA" >> $GITHUB_OUTPUT
- name: Download artifact from the last successful build
id: last-artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yaml
workflow_search: false
workflow_conclusion: success
name: latest_base_image_sha
if_no_artifact_found: ignore
- name: Get SHA of the base image from the last successful build
id: last-build
if: steps.last-artifact.outputs.found_artifact == 'true'
run: |
LAST_BUILD_SHA=$(cat latest_base_image_sha)
echo "SHA=$LAST_BUILD_SHA" >> $GITHUB_OUTPUT
- name: Output gathered information
id: debug-output
run: |
echo "aurora-dx:stable is currently at [${{ steps.registry.outputs.SHA }}]"
echo "yaurora has last been built at aurora-dx:stable'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
run: |
echo "Verdict: yaurora needs to be rebuilt"
build:
permissions:
contents: read
packages: write
id-token: write
name: Build Custom Image
needs: check
if: needs.check.outputs.needs_rebuild == 'true'
uses: ./.github/workflows/build.yaml