-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try building KVM qcow2 with GH Actions
- Loading branch information
Showing
3 changed files
with
136 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: KVM Image Build CI | ||
|
||
on: | ||
workflow_dispatch: {} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
filename: build-${{ github.run_number }} | ||
APT_SOURCE: http://azure.archive.ubuntu.com | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt -y install qemu-utils | ||
sudo modprobe nbd | ||
- uses: actions/checkout@v4 | ||
- name: Get base image | ||
run: | | ||
wget --progress=dot:giga \ | ||
-O ~/input.qcow2 \ | ||
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img | ||
- name: Mount image | ||
run: | | ||
qemu-img resize ~/input.qcow2 4096M | ||
sudo qemu-nbd -c /dev/nbd0 ~/input.qcow2 | ||
- name: Build it! | ||
run: | | ||
sudo ./kvmstrap /dev/nbd0p1 | ||
- name: Pack it! | ||
run: | | ||
sudo qemu-nbd -d /dev/nbd0 | ||
qemu-img convert -c -m 2 -O qcow2 -p ~/input.qcow2 ${{ env.filename }}.qcow2 | ||
./infostrap ${{ env.filename }}.qcow2 > ${{ env.filename }}-buildinfo.txt | ||
- name: Upload it! | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: auto-build | ||
files: | | ||
${{ env.filename }}.qcow2 | ||
${{ env.filename }}-buildinfo.txt |
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
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