-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (117 loc) · 5.15 KB
/
custopize.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
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
name: "CustoPiZe"
on:
repository_dispatch:
types: [octoprint_release]
workflow_dispatch:
inputs:
octoprint_version:
description: "OctoPrint version (leave empty to use latest stable release)"
required: false
default: ''
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: "⬇ Checkout"
uses: actions/checkout@v4
- name: "🔎 Get OctoPrint Version"
id: octoprint_latestrelease
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: OctoPrint/OctoPrint
excludes: prerelease, draft
token: ${{ secrets.GITHUB_TOKEN }}
- name: "🔎 Get OctoPi Version"
id: octopi_latestrelease
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: guysoft/OctoPi
token: ${{ secrets.GITHUB_TOKEN }}
- name: "🔎 Determine SimplyPrint version"
id: simplyprint_version
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: SimplyPrint/OctoPrint-SimplyPrint
token: ${{ secrets.GITHUB_TOKEN }}
- name: "⬇ Download latest OctoPi"
id: octopi_download
run: |
mkdir build
cd build
wget https://octopi.octoprint.org/latest -O octopi.zip
unzip octopi.zip
rm octopi.zip
IMAGE=$(ls *.img | head -n 1)
mv $IMAGE input.img
- name: "🏗 Run CustoPiZer"
run: |
sudo modprobe loop
docker run --rm --privileged \
-e OCTOPRINT_VERSION=${{ steps.octoprint_latestrelease.outputs.release }} \
-v ${{ github.workspace }}/scripts/files/config.local:/CustoPiZer/config.local \
-v ${{ github.workspace }}/build:/CustoPiZer/workspace \
-v ${{ github.workspace }}/scripts:/CustoPiZer/workspace/scripts \
ghcr.io/octoprint/custopizer:latest
- name: "📦 Package the image"
run: |
OCTOPI_VERSION="${{ steps.octopi_latestrelease.outputs.release }}"
OCTOPRINT_VERSION="${{ steps.octoprint_latestrelease.outputs.release }}"
IMAGE="SimplyPi-${{ steps.octopi_latestrelease.outputs.release }}-sp${{ steps.simplyprint_version.outputs.release }}-octoprint${{ steps.octoprint_latestrelease.outputs.release }}.img"
echo "IMAGE=$IMAGE" >> $GITHUB_ENV
cd build
mv output.img $IMAGE
zip $IMAGE.zip $IMAGE
md5sum $IMAGE.zip > $IMAGE.zip.md5
sha256sum $IMAGE.zip > $IMAGE.zip.sha256
ZIP_SIZE="$(du -sb $IMAGE.zip | cut -f1)"
ZIP_SHA256="$(cat $IMAGE.zip.sha256 | cut -d' ' -f1)"
IMAGE_SIZE="$(du -sb $IMAGE | cut -f1)"
IMAGE_SHA256="$(sha256sum $IMAGE | cut -d' ' -f1)"
echo "ZIP_SIZE=$ZIP_SIZE" >> $GITHUB_ENV
echo "ZIP_SHA256=$ZIP_SHA256" >> $GITHUB_ENV
echo "IMAGE_SIZE=$IMAGE_SIZE" >> $GITHUB_ENV
echo "IMAGE_SHA256=$IMAGE_SHA256" >> $GITHUB_ENV
- name: "📝 Prepare release"
run: |
RELEASE_NAME="SimplyPi with OctoPrint ${{ steps.octoprint_latestrelease.outputs.release }}, SimplyPrint ${{ steps.simplyprint_version.outputs.release }} (based on OctoPi ${{ steps.octopi_latestrelease.outputs.release }})"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
RELEASE_TAG="${{ steps.octopi_latestrelease.outputs.release }}.op${{ steps.octoprint_latestrelease.outputs.release }}.sp${{ steps.simplyprint_version.outputs.release }}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
RELEASE_BODY=""
(git rev-parse $RELEASE_TAG >/dev/null 2>&1) || RELEASE_BODY="Created with [CustoPiZer](https://github.com/OctoPrint/CustoPiZer)"
echo "RELEASE_BODY=$RELEASE_BODY" >> $GITHUB_ENV
RELEASE_DATE="$(date -u +"%Y-%m-%d")"
cat > build/rpi-imager-simplypi.json << EOF
{
"os_list": [
{
"name": "SimplyPrint OS (aka. SimplyPi - latest)",
"description": "Effortlessly manage 1, 2 or 100 3D printers from anywhere with the SimplyPrint ecosystem - free and easy to set up (SimplyPrint plugin on top of OctoPrint)",
"url": "https://github.com/SimplyPrint/SimplyPi/releases/download/$RELEASE_TAG/$IMAGE.zip",
"icon": "https://cdn.simplyprint.io/i/static/rpi-imager/icon_gradient.png",
"extract_size": $IMAGE_SIZE,
"extract_sha256": "$IMAGE_SHA256",
"image_download_size": $ZIP_SIZE,
"release_date": "$RELEASE_DATE",
"image_download_sha256": "$ZIP_SHA256",
"init_format": "systemd"
}
]
}
EOF
- name: "🔖 Create release & attach assets"
uses: softprops/action-gh-release@v1
with:
name: "${{ env.RELEASE_NAME }}"
tag_name: "${{ env.RELEASE_TAG }}"
body: "${{ env.RELEASE_BODY }}"
prerelease: ${{ contains(env.OCTOPRINT_VERSION, 'rc') }}
fail_on_unmatched_files: true
files: |
build/${{ env.IMAGE }}.zip
build/${{ env.IMAGE }}.zip.md5
build/${{ env.IMAGE }}.zip.sha256
build/rpi-imager-simplypi.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}