Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rework build workflow for multiple images #152

Merged
merged 2 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/BuildImages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build MainsailOS
on:
push:
branches:
- "master"
- "develop"
paths:
- "src/**"
- "emulation/**"
- ".github/workflows/BuildImages.yml"
tags-ignore:
- "**"
pull_request:
types: [opened, edited, reopened, synchronize]
paths:
- "src/**"
- "emulation/**"
- ".github/workflows/BuildImages.yml"

workflow_dispatch:


# Allow to stop obsolete workflows
concurrency:
group: ci-buildtrain-${{ github.ref }}-1
cancel-in-progress: true

jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create Matrix
id: set-matrix
run: |
ARRAY=$(find ${{ github.workspace }}/config -type f -printf '%P\n' | sed '/default/d' | sort | jq -R -s -c 'split("\n")[:-1]')
echo "::set-output name=matrix::${ARRAY}"

build:
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Build image
uses: mainsail-crew/MainsailOS-actions/build-image@master
with:
config: ${{ matrix.config }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Copy output
id: copy-image
shell: bash
run: |
source repository/src/config
NOW="$(date +"%Y-%m-%d")"
IMAGE="${NOW}-${DIST_NAME}-${DIST_VERSION}-${{ steps.config.outputs.TYPE }}-${{ steps.config.outputs.SBC }}"

cp repository/src/workspace/*.img $IMAGE.img

echo "::set-output name=image::$IMAGE"

- name: Compressing Image
shell: bash
run: xz -efkvz ${{ steps.copy-image.outputs.image }}.img

- name: Calculating checksums
shell: bash
run: |
sha256sum ${{ steps.copy-image.outputs.image }}.img > ${{ steps.copy-image.outputs.image }}.img.sha256
sha256sum ${{ steps.copy-image.outputs.image }}.img.xz > ${{ steps.copy-image.outputs.image }}.img.xz.sha256

- name: Upload Compressed Image
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.xz
path: ${{ steps.copy-image.outputs.image }}.img.xz

- name: Upload Compressed Image Checksum
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.xz.sha256
path: ${{ steps.copy-image.outputs.image }}.img.xz.sha256

- name: Upload Image Checksum
uses: actions/upload-artifact@v3
with:
name: ${{ steps.copy-image.outputs.image }}.img.sha256
path: ${{ steps.copy-image.outputs.image }}.img.sha256
120 changes: 0 additions & 120 deletions .github/workflows/BuildRaspiOS.yml

This file was deleted.

10 changes: 10 additions & 0 deletions config/armbian/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export BASE_APT_CACHE=no
export OCTOPI_INCLUDE_WIRINGPI=no
export BASE_DISTRO=armbian
export BASE_ROOT_PARTITION=2
export BASE_IMAGE_RESIZEROOT=500
export BASE_IMAGE_RASPBIAN=no
export BASE_IMAGE_ENLARGEROOT=1000
export BASE_ARCH=arm64

export MODULES="base,pkgupgrade"
3 changes: 3 additions & 0 deletions config/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export DIST_NAME=MainsailOS
export DIST_VERSION=0.7.1
export BASE_ZIP_IMG=`ls -t ${DIST_PATH}/image/*.{zip,7z,xz} | head -n 1`
3 changes: 3 additions & 0 deletions config/raspberry/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export BASE_IMAGE_ENLARGEROOT=2500
export BASE_RELEASE_COMPRESS=yes
export BASE_IMAGE_RESIZEROOT=600
3 changes: 3 additions & 0 deletions config/raspberry/rpi32
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export DOWNLOAD_URL_CHECKSUM="https://downloads.raspberrypi.org/raspios_lite_armhf_latest.sha256"
export DOWNLOAD_URL_IMAGE="https://downloads.raspberrypi.org/raspios_lite_armhf_latest.torrent"
export MODULES="base,pkgupgrade,mainsailos(net,piconfig,klipper,is_req_preinstall,moonraker,timelapse,mainsail,crowsnest,sonar,password-for-sudo),postrename"
9 changes: 0 additions & 9 deletions src/config

This file was deleted.