Skip to content

TurtleBot3c Ubuntu Core image #55

TurtleBot3c Ubuntu Core image

TurtleBot3c Ubuntu Core image #55

name: TurtleBot3c Ubuntu Core image
on:
push:
branches:
- humble-virtual
tags:
- '*-humble-virtual'
pull_request:
branches:
- humble-virtual
workflow_dispatch:
jobs:
turtlebot3c-gadget-snap:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Build snap
id: build-snap
uses: snapcore/action-build@v1
with:
path: turtlebot3c-gadget
- name: Upload snap artifact
uses: actions/upload-artifact@v4
with:
name: turtlebot3c-gadget-snap
path: ${{ steps.build-snap.outputs.snap }}
ubuntu-image:
runs-on: ubuntu-latest
needs: turtlebot3c-gadget-snap
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download gadget snap
uses: actions/download-artifact@v4
with:
name: turtlebot3c-gadget-snap
path: gadget
- name: Build the Ubuntu Core image
run: |
sudo snap install ubuntu-image --classic
ubuntu-image snap turtlebot3c.model --snap ./gadget/turtlebot3c*.snap
- name: Upload snap artifact
uses: actions/upload-artifact@v4
with:
name: turtlebot3c-ubuntu-image
path: turtlebot3c.img
- name: Upload metadata artifact
uses: actions/upload-artifact@v4
with:
name: turtlebot3c-metadata
path: metadata.tar.gz
qcow2-convertion:
runs-on: ubuntu-latest
needs: ubuntu-image
steps:
- name: Download TurtleBot3c image
uses: actions/download-artifact@v4
with:
name: turtlebot3c-ubuntu-image
path: .
- name: Install qemu-utils
run: sudo apt-get install -y qemu-utils
- name: Convert image to qcow2
run: qemu-img convert -f raw turtlebot3c.img -O qcow2 turtlebot3c.qcow2
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: turtlebot3c-ubuntu-qcow2-image
path: turtlebot3c.qcow2
release-image:
runs-on: ubuntu-latest
needs: qcow2-convertion
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download TurtleBot3c image
uses: actions/download-artifact@v4
with:
name: turtlebot3c-ubuntu-image
path: .
- name: Download TurtleBot3c qcow2 image
uses: actions/download-artifact@v4
with:
name: turtlebot3c-ubuntu-qcow2-image
path: .
- name: Download TurtleBot3c metadata
uses: actions/download-artifact@v4
with:
name: turtlebot3c-metadata
path: .
# The image must be compressed.
# GH release max file size is 2GB
# and the uncompressed image is 3.5GB.
- name: Compress the Ubuntu image
run: tar czf turtlebot3c.img.tar.gz turtlebot3c.img
- name: Compress the Ubuntu qcow2 image
run: tar czf turtlebot3c.qcow2.tar.gz turtlebot3c.qcow2 metadata.tar.gz
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
turtlebot3c.img.tar.gz
turtlebot3c.qcow2.tar.gz