Skip to content

Build and Release Pi Image #22

Build and Release Pi Image

Build and Release Pi Image #22

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 "" >> ./config
# echo "export DWE_VERSION=\"${{ github.event.release.name }}\"" >> ./config
# echo "" >> ./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 }}
build_docker_image:
runs-on: ubuntu-22.04-arm
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
with:
platforms: linux/arm/v7
- name: "Log in to Docker Hub"
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: "Build Project"
run: |
./install_requirements.sh
./create_release.sh << ${{ github.event.release.name }}
- name: "Build Docker Image"
run: |
echo "Building Docker Image..."
sudo docker buildx build --platform linux/arm/v7 -t dwe_os_2 --load -f docker/Dockerfile .
docker tag dwe_os_2:${{ github.event.release.name }} dwe_os_2:latest
- name: "Push Docker Image"
run: |
echo "Pushing Docker Image..."
docker push dwe_os_2:${{ github.event.release.name }}
docker push dwe_os_2:latest