Skip to content

Build and Release Pi Image #15

Build and Release Pi Image

Build and Release Pi Image #15

Workflow file for this run

name: Build and Release Pi Image
on:
release:
types: [published]
permissions:
contents: write # Required to upload release assets
jobs:
build_and_upload_image:
runs-on: ubuntu-22.04-arm
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: "Set up Node.js"
uses: actions/setup-node@v3
with:
node-version: '22'
- name: "Install Dependencies"
run: |
echo "Installing dependencies..."
./install_requirements.sh
- name: "Run Create Release Script"
run: |
echo "Creating release..."
chmod +x ./create_release.sh
pip install requests
# Pass the release name to the script
./create_release.sh << ${{ github.event.release.name }}
- name: "Upload release"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: release.tar.gz
asset_name: release.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Checkout Pi Image Repository"
uses: actions/checkout@v4
with:
repository: DeepWaterExploration/pi-gen
path: pi-gen
- name: "Install Dependencies for Pi Image Build"
run: |
echo "Installing dependencies..."
sudo apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \
gpg pigz xxd arch-test
- name: "Build Pi Image"
run: |
echo "Building Pi Image..."
cd pi-gen
echo "export DWE_VERSION=\"${{ github.event.release.name }}\"" >> config
sudo ./build.sh -c ./config
- name: "Fix Permissions of Deploy Directory"
run: sudo chown -R runner:runner pi-gen/deploy
- name: "Find Pi Image File"
id: find_image
run: |
IMAGE_FILE=$(find pi-gen/deploy -name "*.zip" | head -1)
echo "image_file=$IMAGE_FILE" >> $GITHUB_OUTPUT
- name: "Upload Pi Image to Release"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.find_image.outputs.image_file }}
asset_name: DWE_OS_${{ github.event.release.name }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}