-
Notifications
You must be signed in to change notification settings - Fork 8
112 lines (107 loc) · 2.97 KB
/
bake-image.yml
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
name: Bake Image
permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- "*"
jobs:
info:
name: Build information
runs-on: ubuntu-latest
outputs:
version: ${{ steps.info.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: sudo snap install --edge --classic just
- id: info
name: Get Version
run: |
case "${GITHUB_REF}" in
refs/tags/*)
version="${GITHUB_REF#refs/*/}"
echo "Using version from tag: $version"
;;
*)
version="$(just generate_version)"
echo "Using version from timestamp: $version"
;;
esac
echo "version=$version" >> "$GITHUB_OUTPUT"
bake-image:
name: Bake Image ${{ matrix.job.image }}
runs-on: ubuntu-latest
needs: info
strategy:
fail-fast: false
matrix:
job:
- { image: pi4 }
- { image: tryboot }
- { image: tryboot-containers }
- { image: u-boot }
- { image: u-boot-containers }
- { image: u-boot-armhf }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- run: sudo snap install --edge --classic just
- name: Install dependencies
run: just setup
- id: info
env:
VERSION: ${{needs.info.outputs.version}}
run: |
source <(just show)
echo "PREFIX=$PREFIX" >> "$GITHUB_OUTPUT"
- name: Configure .env
env:
IMAGE_CONFIG: ${{secrets.IMAGE_CONFIG || ''}}
run: |
echo "IMAGE_NAME=${{ steps.info.outputs.PREFIX }}${{ matrix.job.image }}_${{ needs.info.outputs.version }}" > ".env"
if [ -n "$IMAGE_CONFIG" ]; then
echo "Adding custom IMAGE_CONFIG settings to .env"
echo "$IMAGE_CONFIG" >> ".env"
fi
- name: Build image
env:
VERSION: ${{needs.info.outputs.version}}
run: |
just IMAGE=${{ matrix.job.image }} build
- name: Upload Image
uses: actions/upload-artifact@v4
with:
name: ${{ steps.info.outputs.PREFIX }}${{ matrix.job.image }}_${{ needs.info.outputs.version }}
path: |
build/
*.sbom.txt
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- info
- bake-image
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: release
- name: Show release artifacts
run: ls -l release/*/*
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
generate_release_notes: true
draft: true
files: |
./release/*/*
./release/*/*/*