Merge pull request #64 from dhruveshb-mecha/dev-v4 #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Debian Build | |
on: | |
push: | |
branches: | |
- main | |
- dev* | |
paths: | |
- debian/distro/** | |
- .github/workflows/debian-build.yml | |
workflow_dispatch: # Enables manual triggering of the workflow | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
env: | |
DEBEMAIL: "[email protected]" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Debug - List contents of debian directory | |
run: | | |
ls -R debian/packages | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: debian/distro.Dockerfile | |
push: false | |
load: true | |
tags: mechasystems/distro:latest | |
- name: Debug - List Docker images | |
run: docker images | |
- name: Debug - Show Docker image details | |
run: docker inspect mechasystems/distro:latest | |
- name: Remove existing container if it exists | |
run: | | |
docker rm -f distro-container || true | |
- name: Make artifacts directory | |
run: mkdir -p artifacts | |
- name: Run Docker container and collect artifacts | |
run: | | |
docker run --name distro-container mechasystems/distro:latest | |
docker ps -a | |
docker logs distro-container | |
docker cp distro-container:/build/assets/deploy/debian-image-rootfs.tar.gz ./artifacts || echo "Failed to copy artifacts" | |
- name: Debug - List container filesystem | |
if: failure() | |
run: | | |
docker exec distro-container ls -R / | |
- name: list artifacts | |
run: | | |
ls -R ./artifacts || echo "No artifacts found" | |
- name: Clean up | |
if: always() | |
run: | | |
docker stop distro-container || true | |
docker rm distro-container || true | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debian-image-rootfs.tar.gz | |
path: ./artifacts/* | |