-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (116 loc) · 4.33 KB
/
Copy pathbuild.yml
File metadata and controls
128 lines (116 loc) · 4.33 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: bluebuild
on:
schedule:
- cron:
"00 07 * * *" # build at 07:00 UTC every day
# (1 hour after winblues/vauxite)
push:
paths-ignore: # don't rebuild if only documentation has changed
- "**.md"
pull_request:
workflow_dispatch: # allow manually triggering builds
concurrency:
# only run one build at a time
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
check-changes:
name: Check for xfce-winxp-tc.env changes
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check if xfce-winxp-tc.env changed
id: check
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git fetch origin "${{ github.event.pull_request.base.sha }}" --depth=1 2>/dev/null || true
CHANGED=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" HEAD -- files/xfce-winxp-tc.env | wc -l)
elif [[ "${{ github.event_name }}" == "push" ]]; then
BEFORE="${{ github.event.before }}"
if [[ "$BEFORE" == "0000000000000000000000000000000000000000" ]]; then
CHANGED=0
else
CHANGED=$(git diff --name-only "$BEFORE" "${{ github.sha }}" -- files/xfce-winxp-tc.env | wc -l)
fi
else
# schedule, workflow_dispatch: use already-published artifact
CHANGED=0
fi
if [[ "$CHANGED" -gt 0 ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
build-packages:
name: Build xfce-winxp-tc packages
needs: check-changes
if: needs.check-changes.outputs.changed == 'true'
uses: ./.github/workflows/build-packages.yml
permissions:
contents: read
packages: write
build-image:
name: Build image
needs: [check-changes, build-packages]
if: ${{ needs.check-changes.result == 'success' && (needs.build-packages.result == 'success' || needs.build-packages.result == 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false # stop GH from cancelling all matrix builds if one fails
matrix:
recipe:
# !! Add your recipes here
- recipe.yml
steps:
# the build is fully handled by the reusable github action
- name: Build Custom Image
uses: blue-build/github-action@v1.11
with:
recipe: ${{ matrix.recipe }}
cosign_private_key: ${{ secrets.SIGNING_SECRET }}
registry_token: ${{ github.token }}
pr_event_number: ${{ github.event.number }}
# enabled by default, disable if your image is small and you want faster builds
maximize_build_space: true
smoke-test:
name: Smoke test
needs: build-image
runs-on: ubuntu-latest
if: false
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enable KVM
run: sudo chmod 666 /dev/kvm
- name: Install prerequisites
run: |
ORAS_VERSION="1.2.0"
curl -LO "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz"
tar -zxf "oras_${ORAS_VERSION}_linux_amd64.tar.gz"
sudo mv oras /usr/local/bin/
sudo apt-get install -y qemu-system-x86
- name: Read Fedora version
id: fedora
run: |
echo "version=$(grep 'image-version:' recipes/recipe.yml | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Determine image reference
id: image-ref
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "ref=ghcr.io/winblues/bluexp:pr-${{ github.event.number }}-${{ steps.fedora.outputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "ref=ghcr.io/winblues/bluexp:latest" >> "$GITHUB_OUTPUT"
fi
- name: Pull image into local storage
run: sudo podman pull "${{ steps.image-ref.outputs.ref }}"
- name: Run smoke test
run: scripts/smoke-test.sh "${{ steps.image-ref.outputs.ref }}"