Skip to content

octoprint_release

octoprint_release #85

Workflow file for this run

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 }}