Export image after solar stage #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Raspberry Pi Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout pi-gen | |
uses: actions/checkout@v4 | |
with: | |
repository: 'RPi-Distro/pi-gen' | |
- name: checkout solar protocol | |
uses: actions/checkout@v4 | |
with: | |
path: 'solar-protocol' | |
- name: install build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y < depends | |
sudo apt install -y qemu-user-static | |
sudo apt install -y openssl | |
- name: generate pi-gen config | |
id: config | |
run: | | |
cp -r solar-protocol/utilities/pi-gen/stage-solar . | |
export \ | |
VERSION=1.1-${GITHUB_SHA::6} \ | |
PUBKEY_SSH_FIRST_USER="$(<solar-protocol/utilities/authorized_keys)" \ | |
FIRST_USER_PASS=$(openssl rand -hex 16) | |
envsubst < stage-solar/config.template > config | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
AUTHORIZED_USERS=$(echo "$PUBKEY_SSH_FIRST_USER" | cut -d ' ' -f3 | cut -d '@' -f1 | sort -u | paste -s -d ',' -) | |
echo installed keys for ${AUTHORIZED_USERS} >> $GITHUB_STEP_SUMMARY | |
- name: build image | |
run: ./build-docker.sh | |
- name: create checksum | |
run: | | |
cd deploy | |
export image_filename=$(ls *-${{ steps.config.outputs.version }}.img.xz) | |
sha256sum ${image_filename} > ${image_filename}.sha256sum | |
- name: upload image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.config.outputs.version }} | |
path: | | |
deploy/*-${{ steps.config.outputs.version }}.img.xz | |
deploy/*-${{ steps.config.outputs.version }}.img.xz.sha256sum | |
compression-level: 0 | |
- name: create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ steps.config.outputs.version }} | |
files: | | |
deploy/${{ steps.config.outputs.version }}.img.xz | |
deploy/${{ steps.config.outputs.version }}.img.xz.sha256sum | |
generate_release_notes: true |