Skip to content

pi-topOS Build

pi-topOS Build #56

Workflow file for this run

name: pi-topOS Build
on:
workflow_dispatch:
inputs:
repo_name:
description: 'Repository to build against'
required: true
default: 'release'
type: choice
options:
- unstable
- testing
- release
distro_name:
description: 'OS distribution'
required: true
default: 'bookworm'
type: choice
options:
- bullseye
- bookworm
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type_suffix: ["", "-lite"]
architecture: ["armhf", "arm64"]
steps:
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v2.7.0
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: GCS auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GOOGLE_CLOUD_AUTH_JSON_CREDENTIALS }}
# - uses: aarcangeli/load-dotenv@v1.0.0
# - name: Get build type and RPi OS image name
# run: |
# build_type="${{ matrix.architecture }}${{ matrix.build_type_suffix }}"
# echo "BUILD_TYPE=${build_type}" >> $GITHUB_ENV
# echo "IMAGE_NAME=${{ env.RASPIOS_BUILD_DATE }}-raspios-${{ inputs.distro_name }}-${build_type}" >> $GITHUB_ENV
# - name: Install ansible and playbook dependencies
# # Install 'qemu-user-static' >v5 to allow 'arm64' chroot
# # 'ubuntu-20.04' (currently latest) does not have an up-to-date version, so we install from `ubuntu-security` repo
# run: |
# wget http://old-releases.ubuntu.com/ubuntu/pool/universe/q/qemu/qemu-user-static_5.2+dfsg-9ubuntu3.1_amd64.deb
# sudo apt-get update && sudo apt-get install -y \
# ansible \
# unzip \
# zerofree \
# ./qemu-user-static_5.2+dfsg-9ubuntu3.1_amd64.deb
# - name: Build
# run: |
# export ANSIBLE_FORCE_COLOR=true
# export TERM=xterm-color
# # chroot connection requires running as root
# # 'ansible-playbook' is not in root user's PATH
# ANSIBLE="sudo $(which ansible-playbook) -i inventory -vv"
# build_type_dir="raspios_$(echo ${{ env.BUILD_TYPE }} | python3 -c "import sys; print('_'.join(reversed(sys.stdin.read().strip().split('-'))))")"
# url="https://downloads.raspberrypi.org/${build_type_dir}/images/${build_type_dir}-${{ env.RASPIOS_RELEASE_DATE }}/${{ env.IMAGE_NAME }}.img.xz"
# echo "==> Running get_raspios playbook..."
# ${ANSIBLE} --extra-vars "raspi_os_url=${url}" \
# --extra-vars "image_name=${{ env.IMAGE_NAME }}" \
# playbooks/get_raspios.yml
# echo "==> Running mount_raspios playbook..."
# ${ANSIBLE} --extra-vars "image_name=${{ env.IMAGE_NAME }}" \
# playbooks/mount_raspios.yml
# echo "==> Running create_pi_top_os_image playbook..."
# ${ANSIBLE} playbooks/create_pi_top_os_image.yml
# echo "==> Running mount_pi_top_os playbook..."
# ${ANSIBLE} playbooks/mount_pi_top_os.yml
# echo "==> Running install_pi_top_os playbook..."
# ${ANSIBLE} --extra-vars "repo_name=${{ inputs.repo_name }}" \
# --extra-vars "distro_name=${{ inputs.distro_name }}" \
# --extra-vars "top_level_pkg=pt-os${{ matrix.build_type_suffix }}" \
# --extra-vars "{'full_install': ${{ matrix.build_type_suffix == '' }}}" \
# playbooks/install_pi_top_os.yml
# echo "==> Running configure_pi_top_os playbook..."
# ${ANSIBLE} --extra-vars "distro_name=${{ inputs.distro_name }}" \
# --extra-vars "build_number=${{ github.run_number || github.run_id }}" \
# --extra-vars "build_repo_commit=$(git rev-parse HEAD)" \
# --extra-vars "build_repo_commit_short=$(git rev-parse --short HEAD)" \
# --extra-vars "build_action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
# --extra-vars "build_repo_name=${{ inputs.repo_name }}" \
# --extra-vars "build_type=${{ env.BUILD_TYPE }}" \
# playbooks/configure_pi_top_os.yml
# echo "==> Running finalise_pi_top_image playbook..."
# ${ANSIBLE} --extra-vars "distro_name=${{ inputs.distro_name }}" \
# --extra-vars "build_number=${{ github.run_number || github.run_id }}" \
# --extra-vars "build_repo_name=${{ inputs.repo_name }}" \
# --extra-vars "build_type=${{ env.BUILD_TYPE }}" \
# playbooks/finalise_pi_top_image.yml
# echo "==> Running analyse_build playbook..."
# ${ANSIBLE} --extra-vars "build_number=${{ github.run_number || github.run_id }}" \
# playbooks/analyse_build.yml
# - name: Cleanup (to avoid CI space issues)
# run: |
# ls -l playbooks/artifacts
# sudo rm -f playbooks/artifacts/*.img
# ls -l playbooks/artifacts
# - name: Get current date
# id: date
# run: echo "DATE_STAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# - name: Upload OS zip contents
# uses: actions/upload-artifact@v3
# with:
# name: pi-topOS_${{ inputs.distro_name }}_${{ inputs.repo_name }}_${{ env.BUILD_TYPE }}_${{ env.DATE_STAMP }}_B${{ github.run_number || github.run_id }}
# if-no-files-found: error
# path: |
# playbooks/artifacts/*
# - name: Print metadata
# run: cat playbooks/artifacts/metadata.txt
- name: List files to upload to GCS
run: |
mkdir -p playbooks/artifacts
touch playbooks/artifacts/pi-topOS-${{ inputs.distro_name }}-${{ matrix.architecture }}.zip
ls -lh playbooks/artifacts/*.zip
- name: Upload OS zip to GCS
uses: google-github-actions/upload-cloud-storage@v2.1.0
with:
path: 'playbooks/artifacts'
glob: '*.zip'
parent: false
destination: ${{ secrets.GOOGLE_CLOUD_OS_UPLOAD_BUCKET }}/pi-topOS-${{ inputs.distro_name }}/