forked from OctoPrint/CustoPiZer
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (138 loc) · 6.31 KB
/
custopize.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: "CustoPiZe"
on:
repository_dispatch:
types: pioreactor_release
workflow_dispatch:
inputs:
pioreactor_version:
description: "Pioreactor version"
required: true
default: ''
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: "⬇ Checkout"
uses: actions/checkout@v3
- name: "🔎 Determine Pioreactor version"
run: |
if [[ "${{ github.event_name }}" = "repository_dispatch" && "${{ github.event.action }}" = "pioreactor_release" ]]; then
PIOREACTOR_VERSION="${{ github.event.client_payload.version }}"
echo "Version from repository dispatch: $PIOREACTOR_VERSION"
else
PIOREACTOR_VERSION="${{ github.event.inputs.pioreactor_version }}"
echo "Version from workflow dispatch: $PIOREACTOR_VERSION"
fi
echo "PIOREACTOR_VERSION=$PIOREACTOR_VERSION" >> $GITHUB_ENV
- name: "⬇ Download RPi image"
id: download_rpi_image
run: |
mkdir -p build
cd build
wget https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-07-04/2024-07-04-raspios-bookworm-armhf-lite.img.xz -q -O input.img.xz
unxz -f input.img.xz
- name: "📝 Prepare release"
run: |
now=$(date +"%Y%m%d%H%M%S")
RELEASE_NAME="Pioreactor ${{ env.PIOREACTOR_VERSION }} (build $now)"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
RELEASE_TAG="${{ env.PIOREACTOR_VERSION }}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
# release body
cat <<EOF > ./build/release.md
* Pioreactor ${{ env.PIOREACTOR_VERSION }}
Created with [CustoPiZer](https://github.com/Pioreactor/CustoPiZer)
<!-- mark:untested -->
EOF
- name: "🏗 Run CustoPiZer LW"
uses: Pioreactor/CustoPiZer@pioreactor
with:
workspace: "${{ github.workspace }}/build"
scripts: "${{ github.workspace }}/workspace/scripts"
config: "${{ github.workspace }}/config.local"
environment: '{ "PIO_VERSION": "${{ env.PIOREACTOR_VERSION }}", "LEADER": 1, "WORKER": 1, "HEADLESS": 1, "CUSTOPIZER_GIT_COMMIT": "${{ github.sha }}"}'
- name: "✏ Rename image LW"
run: |
IMAGE_LEADER_WORKER="pioreactor_leader_worker.img"
echo "IMAGE_LEADER_WORKER=$IMAGE_LEADER_WORKER" >> $GITHUB_ENV
cd build
mv output.img $IMAGE_LEADER_WORKER
- name: "📦 Package the image LW"
id: package-image-lw
uses: OctoPrint/actions/package-rpi-image@main
with:
image_path: "build/${{ env.IMAGE_LEADER_WORKER }}"
- name: 📨 Export zip name to env LW
run: |
IMAGE_LEADER_WORKER_URL=https://github.com/Pioreactor/CustoPiZer/releases/download/${{ env.RELEASE_TAG }}/${{ steps.package-image-lw.outputs.zip_name }}
echo "IMAGE_LEADER_WORKER_ZIP=${{ steps.package-image-lw.outputs.zip_name }}" >> $GITHUB_ENV
echo "IMAGE_LEADER_WORKER_URL=$IMAGE_LEADER_WORKER_URL" >> $GITHUB_ENV
echo "Link to leader image: $IMAGE_LEADER_WORKER_URL" >> $GITHUB_STEP_SUMMARY
- name: "🏗 Run CustoPiZer L"
uses: Pioreactor/CustoPiZer@pioreactor
with:
workspace: "${{ github.workspace }}/build"
scripts: "${{ github.workspace }}/workspace/scripts"
config: "${{ github.workspace }}/config.local"
environment: '{ "PIO_VERSION": "${{ env.PIOREACTOR_VERSION }}", "LEADER": 1, "WORKER": 0, "HEADLESS": 1, "CUSTOPIZER_GIT_COMMIT": "${{ github.sha }}"}'
- name: "✏ Rename image L"
run: |
IMAGE_LEADER="pioreactor_leader.img"
echo "IMAGE_LEADER=$IMAGE_LEADER" >> $GITHUB_ENV
cd build
mv output.img $IMAGE_LEADER
- name: "📦 Package the image L"
id: package-image-l
uses: OctoPrint/actions/package-rpi-image@main
with:
image_path: "build/${{ env.IMAGE_LEADER }}"
- name: 📨 Export zip name to env L
run: |
IMAGE_LEADER_URL=https://github.com/Pioreactor/CustoPiZer/releases/download/${{ env.RELEASE_TAG }}/${{ steps.package-image-l.outputs.zip_name }}
echo "IMAGE_LEADER_ZIP=${{ steps.package-image-l.outputs.zip_name }}" >> $GITHUB_ENV
echo "IMAGE_LEADER_URL=$IMAGE_LEADER_URL" >> $GITHUB_ENV
echo "Link to leader image: $IMAGE_LEADER_URL" >> $GITHUB_STEP_SUMMARY
- name: "🏗 Run CustoPiZer W"
uses: Pioreactor/CustoPiZer@pioreactor
with:
workspace: "${{ github.workspace }}/build"
scripts: "${{ github.workspace }}/workspace/scripts"
config: "${{ github.workspace }}/config.local"
environment: '{ "PIO_VERSION": "${{ env.PIOREACTOR_VERSION }}", "LEADER": 0, "WORKER": 1, "HEADLESS": 1, "CUSTOPIZER_GIT_COMMIT": "${{ github.sha }}" }'
- name: "✏ Rename image W"
run: |
IMAGE_WORKER="pioreactor_worker.img"
echo "IMAGE_WORKER=$IMAGE_WORKER" >> $GITHUB_ENV
cd build
mv output.img $IMAGE_WORKER
- name: "📦 Package the image W"
id: package-image-w
uses: OctoPrint/actions/package-rpi-image@main
with:
image_path: "build/${{ env.IMAGE_WORKER }}"
- name: 📨 Export zip name to env W
run: |
echo "IMAGE_WORKER_ZIP=${{ steps.package-image-w.outputs.zip_name }}" >> $GITHUB_ENV
echo "IMAGE_WORKER_URL=https://github.com/Pioreactor/CustoPiZer/releases/download/${{ env.RELEASE_TAG }}/${{ steps.package-image-w.outputs.zip_name }}" >> $GITHUB_ENV
- name: "🔖 Create release & attach assets"
uses: softprops/action-gh-release@v1
if: github.event_name == 'repository_dispatch'
with:
name: "${{ env.RELEASE_NAME }}"
tag_name: "${{ env.RELEASE_TAG }}"
body_path: "build/release.md"
prerelease: ${{ contains(env.PIOREACTOR_VERSION, 'rc') }}
fail_on_unmatched_files: true
files: |
build/${{ env.IMAGE_LEADER_WORKER_ZIP }}
build/${{ env.IMAGE_LEADER_WORKER_ZIP }}.md5
build/${{ env.IMAGE_LEADER_WORKER_ZIP }}.sha256
build/${{ env.IMAGE_LEADER_ZIP }}
build/${{ env.IMAGE_LEADER_ZIP }}.md5
build/${{ env.IMAGE_LEADER_ZIP }}.sha256
build/${{ env.IMAGE_WORKER_ZIP }}
build/${{ env.IMAGE_WORKER_ZIP }}.md5
build/${{ env.IMAGE_WORKER_ZIP }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}