Skip to content

Build Image

Build Image #827

Workflow file for this run

---
name: Build Image
on:
workflow_dispatch:
pull_request:
push:
branches:
- '**'
- '!release/*'
paths:
- 'src/*'
- '.github/workflows/build.yaml'
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt update
sudo apt install coreutils p7zip-full qemu-user-static
- name: Checkout CustomPiOS
uses: actions/checkout@v4.2.2
with:
repository: 'guysoft/CustomPiOS'
path: CustomPiOS
ref: "baaa155f33f54fa0e777039dd47cca751fa55802"
- name: Checkout Project Repository
uses: actions/checkout@v4.2.2
with:
path: repository
submodules: true
# wget -c --trust-server-names 'https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz'
- name: Download Raspbian or Ubuntu Image
run: |
cd repository/src/image
wget -c --trust-server-names 'https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.5-preinstalled-server-arm64+raspi.img.xz'
- name: Update CustomPiOS Paths
run: |
cd repository/src
../../CustomPiOS/src/update-custompios-paths
- name: Set nightly image version
if: github.event_name == 'schedule'
run: |
source repository/src/config
NOW=$(date +"%Y-%m-%d")
echo "DIST_VERSION=$DIST_VERSION-$NOW-nightly" > repository/src/config.local
- name: Build Image
run: |
sudo modprobe loop
cd repository/src
sudo bash -x ./build_dist
- name: Copy output
id: copy
run: |
source repository/src/config
NOW=$(date +"%Y-%m-%d")
TAG=${DIST_VERSION}-${NOW}-nightly
IMAGE=monsterpi-$TAG
cp repository/src/workspace/*.img $IMAGE.img
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "image=$IMAGE" >> $GITHUB_OUTPUT
- name: Show size and tag
run: |
echo "Tag ${{steps.copy.outputs.tag}}"
echo "File size of ${{ steps.copy.outputs.image }}.img"
stat --printf="%s" ${{ steps.copy.outputs.image }}.img
- name: Zip Image
if: github.event_name == 'schedule'
run: |
zip ${{ steps.copy.outputs.image }}.zip ${{ steps.copy.outputs.image }}.img
echo "File size of ${{ steps.copy.outputs.image }}.zip"
stat --printf="%s" ${{ steps.copy.outputs.image }}.zip
# - name: Create release
# uses: actions/create-release@v1
# if: github.event_name == 'schedule'
# id: create_release
# with:
# draft: ${{ github.ref_name == 'develop' }}
# prerelease: ${{ contains(env.DIST_VERSION, 'rc') || contains(env.DIST_VERSION, 'unstable') }}
# tag_name: ${{ steps.copy.outputs.tag }}
# release_name: MonsterPi ${{ steps.copy.outputs.image }}
# body: "Release notes not added" # ${{ steps.build_changelog.outputs.changelog }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
#
# - name: Upload server bundle zip
# uses: actions/upload-release-asset@v1
# if: github.event_name == 'schedule'
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ steps.copy.outputs.image }}.zip
# asset_name: ${{ steps.copy.outputs.image }}.zip
# asset_content_type: application/zip