-
Notifications
You must be signed in to change notification settings - Fork 6
131 lines (122 loc) · 4.47 KB
/
image-build.yml
File metadata and controls
131 lines (122 loc) · 4.47 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
129
130
131
name: image-build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "11 11 * * WED"
jobs:
# save minicc and minirouter as artifacts to inject in image later
get-miniccc:
runs-on: ubuntu-latest
container:
image: ghcr.io/sandialabs/sceptre-phenix/minimega:main
steps:
- name: upload miniccc and minirouter
uses: actions/upload-artifact@v4
with:
name: miniexes
path: |
/opt/minimega/bin/miniccc
/opt/minimega/bin/minirouter
# build using phenix image builder
build-bennu:
needs: get-miniccc
runs-on: ubuntu-latest
container:
image: ghcr.io/sandialabs/sceptre-phenix/phenix:31ce034
options: --privileged # needed for kernel device-mapper permissions
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Runs a set of commands using the runners shell
- name: get miniexes
uses: actions/download-artifact@v4.1.8
with:
name: miniexes
# add the miniccc binary
# the phenix base scripts already include the systemd service
- name: add miniccc
run: |
mkdir -p ./overlays/miniccc/opt/minimega/bin
cp ./miniccc ./overlays/miniccc/opt/minimega/bin
chmod +x ./overlays/miniccc/opt/minimega/bin/miniccc
- name: bennu image build
run: |
phenix version
mkdir ./out
phenix image create -O ./overlays/bennu,./overlays/brash,./overlays/miniccc -T ./scripts/aptly,./scripts/bennu --format qcow2 --release jammy -c bennu --size 10G
phenix image build bennu -o ./out -x
# upload bennu qc2 as artifact
- name: upload qc2
uses: actions/upload-artifact@v4
with:
name: bennu.qc2
path: ./out/bennu.qc2
build-ubuntu:
needs: get-miniccc
runs-on: ubuntu-latest
container:
image: ghcr.io/sandialabs/sceptre-phenix/phenix:31ce034
options: --privileged # needed for kernel device-mapper permissions
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Runs a set of commands using the runners shell
- name: get miniexes
uses: actions/download-artifact@v4.1.8
with:
name: miniexes
# add the miniccc binary
# the phenix base scripts already include the systemd service
- name: add miniccc
run: |
mkdir -p ./overlays/miniccc/opt/minimega/bin
cp ./miniccc ./overlays/miniccc/opt/minimega/bin
chmod +x ./overlays/miniccc/opt/minimega/bin/miniccc
- name: ubuntu image build
run: |
phenix version
mkdir ./out
phenix image create -O ./overlays/miniccc -T ./scripts/ubuntu,./scripts/ubuntu-user --format qcow2 --release noble -c ubuntu --size 10G
phenix image build ubuntu -o ./out -x
# upload bennu qc2 as artifact
- name: upload qc2
uses: actions/upload-artifact@v4
with:
name: ubuntu.qc2
path: ./out/ubuntu.qc2
# upload to github release
release:
if: github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
needs:
- build-bennu
- build-ubuntu
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
# - name: get images from artifacts
# uses: actions/download-artifact@v4.1.8
# with:
# pattern: "*.qc2"
# path: ./images
# merge-multiple: true
- name: create release
uses: ncipollo/release-action@v1.15.0
with:
name: release-${{ steps.date.outputs.date }}
body: |
Images are too large to be attached to the release directly.
For the full set of downloadable images, visit the [artifacts page](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
# artifacts: "./images/*.qc2"
tag: release-${{ steps.date.outputs.date }}
commit: main
generateReleaseNotes: true
makeLatest: true