Skip to content

Commit

Permalink
✨ Also update bootloader & kernel
Browse files Browse the repository at this point in the history
And because of that, add a timestamp to the release tag
and also include it in a new file /etc/octopiuptodate-build
inside the image.
  • Loading branch information
foosel committed Jan 19, 2022
1 parent d9545d0 commit a8d37ec
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/custopize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,37 +138,43 @@ jobs:
IMAGE=$(ls *.img | head -n 1)
mv $IMAGE input.img
- name: "📝 Prepare release"
run: |
RELEASE_NAME="OctoPi ${{ env.OCTOPI_VERSION }} with OctoPrint ${{ env.OCTOPRINT_VERSION }}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
now=$(date +"%Y%m%d%H%M%S")
RELEASE_TAG="${{ env.OCTOPI_VERSION }}-${{ env.OCTOPRINT_VERSION }}-$now"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
# release body
cat <<EOF > ./build/release.md
* OctoPi ${{ env.OCTOPI_VERSION }}
* OctoPrint ${{ env.OCTOPRINT_VERSION }}
* Latest kernel & bootloader

Created with [CustoPiZer](https://github.com/OctoPrint/CustoPiZer)
EOF

- name: "🏗 Run CustoPiZer"
uses: OctoPrint/CustoPiZer@main
with:
workspace: "${{ github.workspace }}/build"
scripts: "${{ github.workspace }}/scripts"
environment: '{ "OCTOPRINT_VERSION": "${{ env.OCTOPRINT_VERSION }}" }'
environment: '{ "OCTOPRINT_VERSION": "${{ env.OCTOPRINT_VERSION }}", "RELEASE_TAG": "${{ env.RELEASE_TAG }}" }'

- name: "✏ Rename image"
run: |
OCTOPI_VERSION="${{ env.OCTOPI_VERSION }}"
OCTOPRINT_VERSION="${{ env.OCTOPRINT_VERSION }}"
RELEASE_TAG="${{ env.RELEASE_TAG }}"
IMAGE="octopi-$OCTOPI_VERSION-$OCTOPRINT_VERSION.img"
IMAGE="octopi-$RELEASE_TAG.img"
echo "IMAGE=$IMAGE" >> $GITHUB_ENV
cd build
mv output.img $IMAGE
- name: "📝 Prepare release"
run: |
RELEASE_NAME="OctoPi ${{ env.OCTOPI_VERSION }} with OctoPrint ${{ env.OCTOPRINT_VERSION }}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
RELEASE_TAG="${{ env.OCTOPI_VERSION }}.op${{ env.OCTOPRINT_VERSION }}"
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
- name: "📦 Package the image"
id: package-image
uses: OctoPrint/actions/package-rpi-image@main
Expand All @@ -193,7 +199,7 @@ jobs:
with:
name: "${{ env.RELEASE_NAME }}"
tag_name: "${{ env.RELEASE_TAG }}"
body: "${{ env.RELEASE_BODY }}"
body_path: "build/release.md"
prerelease: ${{ contains(env.OCTOPRINT_VERSION, 'rc') }}
fail_on_unmatched_files: true
files: |
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

*The latest OctoPi release with the latest OctoPrint already included*

This repository automatically updates the OctoPrint installation on the latest OctoPi image
This repository automatically updates the OctoPrint installation, kernel and bootloader on the latest OctoPi image
and provides the resulting image ready to flash. Checkout the [releases](https://github.com/OctoPrint/OctoPi-UpToDate/releases).

## How does this work?

A simple update script is run via [CustoPiZer](https://github.com/OctoPrint/CustoPiZer).
All that is done is running the equivalent of `pip install -U OctoPrint==<latest version>`.
A bunch of simple update scripts are run via [CustoPiZer](https://github.com/OctoPrint/CustoPiZer):

* `01-update-octoprint`: Updates OctoPrint to the latest version
* `02-update-boot`: Updates bootloader and kernel to the latest version
* `99-write-build`: Writes the build tag to `/etc/octopiuptodate-build`

## Can I do something like this as well?

Expand Down
9 changes: 9 additions & 0 deletions scripts/02-update-boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -x
set -e

export LC_ALL=C

source /common.sh
install_cleanup_trap

apt-get install --yes --reinstall raspberrypi-bootloader raspberrypi-kernel
11 changes: 11 additions & 0 deletions scripts/99-write-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -x
set -e

export LC_ALL=C

source /common.sh
install_cleanup_trap

if [ -n "$RELEASE_TAG" ]; then
echo "$RELEASE_TAG" > /etc/octopiuptodate_build
fi

0 comments on commit a8d37ec

Please sign in to comment.