generated from blue-build/template
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (43 loc) · 1.63 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
name: Check if we need to build a new image due to base image update
on:
schedule:
- cron: "30 */4 * * *"
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 docker://ghcr.io/ublue-os/aurora-dx:stable | jq '.Digest' )
echo "SHA=$REGISTRY_SHA" >> $GITHUB_OUTPUT
- name: Get SHA of the base image from the last successful build
id: last-build
run: |
LAST_BUILD_SHA=$(skopeo inspect docker://ghcr.io/yacoob/yaurora:latest | jq '.Labels."org.opencontainers.image.base.digest"')
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'
secrets:
SIGNING_SECRET: ${{ secrets.SIGNING_SECRET }}
uses: ./.github/workflows/build.yaml