Skip to content

Build

Build #30

Workflow file for this run

name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
concurrency:
group: build
cancel-in-progress: false
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: write
packages: write
contents: read
steps:
-
name: Get latest version
run: |
#!/bin/bash
url="https://download.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/v/"
resp=$(curl -sS "$url")
pkg=$(echo "$resp" | grep '<a href="virtio-win')
pkg=$(echo "$pkg" | cut -c21- | cut -d '"' -f1)
latest_tag="${pkg%.el*}"
[ -z "$latest_tag" ] && echo "Tag not found!" && exit 1
echo "Found tag: \"${latest_tag}\""
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
base=$(echo "$latest_tag" | cut -f1 -d"-")
echo "latest_base=$base" >> $GITHUB_ENV
-
name: Check if the tag exists locally
uses: action-pack/tag-exists@v1
id: checkTag
with:
tag: 'v${{ env.latest_tag }}'
-
name: Finish when found
run: |
#!/bin/bash
val="${{ steps.checkTag.outputs.exists }}"
echo "exists=${val}" >> $GITHUB_ENV
-
name: Download package
if: env.exists == 'false'
id: rocky
run: |
#!/bin/bash
url="https://download.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/v/virtio-win-${{ env.latest_tag }}.el9_4.noarch.rpm"
wget "$url" -O "/tmp/latest.rpm" -q
-
name: Process package
if: env.exists == 'false'
id: process
run: |
#!/bin/bash
sudo apt install rdfind genisoimage libarchive-tools
rm -rf /tmp/rpm && mkdir /tmp/rpm
cd /tmp/rpm
rpm2cpio /tmp/latest.rpm | cpio -idmv 2> /dev/null
cp -L /tmp/rpm/usr/share/virtio-win/virtio-win.iso /tmp/rocky.iso
rm -rf /tmp/iso && mkdir /tmp/iso
bsdtar -xf "/tmp/rocky.iso" -C /tmp/iso/
-
name: Add some legacy drivers
if: env.exists == 'false'
id: legacy
run: |
#!/bin/bash
url="https://github.com/qemus/virtiso-whql/releases/download/v1.9.40-0/legacy.zip"
wget "$url" -O "/tmp/legacy.zip" -q
sudo unzip -o /tmp/legacy.zip -d /tmp/iso >/dev/null
-
name: Strip unnecessary bloat
if: env.exists == 'false'
id: strip
run: |
#!/bin/bash
cd /tmp/iso
# Remove bloat
sudo rm /tmp/iso/winfsp-*
sudo rm -rf /tmp/iso/spice-vdagent
sudo rm -rf /tmp/iso/qxl-wddm-dod
# Remove tools for other platforms
sudo rm -rf /tmp/iso/i386
sudo rm -rf /tmp/iso/guest-agent
sudo rm -f /tmp/iso/virtio-win-gt-x86.msi
sudo rm -f /tmp/iso/virtio-win-guest-tools.exe
sudo rm -f /tmp/iso/guest-agent/qemu-ga-i386.msi
# Remove debug symbols
sudo find /tmp/iso -iname "*.pdb" -type f -delete
# Remove binaries for other platforms
sudo find /tmp/iso -iname "x86" -type d -exec rm -rf {} +
sudo find /tmp/iso -iname "arm64" -type d -exec rm -rf {} +
# Remove empty directories
sudo find . -type d -empty -delete
-
name: Create symbolic links
if: env.exists == 'false'
id: symlinks
run: |
#!/bin/bash
sudo cp -lpr /tmp/iso/viogpudo/w8.1 /tmp/iso/viogpudo/w8
# Temporary Win2025 folders
sudo cp -lpr /tmp/iso/amd64/w11 /tmp/iso/amd64/2k25
sudo cp -lpr /tmp/iso/Balloon/w11 /tmp/iso/Balloon/2k25
sudo cp -lpr /tmp/iso/fwcfg/w11 /tmp/iso/fwcfg/2k25
sudo cp -lpr /tmp/iso/NetKVM/w11 /tmp/iso/NetKVM/2k25
sudo cp -lpr /tmp/iso/pvpanic/w11 /tmp/iso/pvpanic/2k25
sudo cp -lpr /tmp/iso/sriov/w11 /tmp/iso/sriov/2k25
sudo cp -lpr /tmp/iso/viofs/w11 /tmp/iso/viofs/2k25
sudo cp -lpr /tmp/iso/vioinput/w11 /tmp/iso/vioinput/2k25
sudo cp -lpr /tmp/iso/viomem/w11 /tmp/iso/viomem/2k25
sudo cp -lpr /tmp/iso/viorng/w11 /tmp/iso/viorng/2k25
sudo cp -lpr /tmp/iso/vioscsi/w11 /tmp/iso/vioscsi/2k25
sudo cp -lpr /tmp/iso/vioserial/w11 /tmp/iso/vioserial/2k25
sudo cp -lpr /tmp/iso/viostor/w11 /tmp/iso/viostor/2k25
sudo cp -lpr /tmp/iso/qemufwcfg/w11 /tmp/iso/qemufwcfg/2k25
sudo cp -lpr /tmp/iso/qemupciserial/w11 /tmp/iso/qemupciserial/2k25
# WDF installer DLL
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/Balloon/xp/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/Balloon/2k3/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/Balloon/2k8/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/pvpanic/2k8/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/vioserial/xp/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/vioserial/2k3/amd64/WdfCoInstaller01009.dll
sudo cp -lp /tmp/iso/vioserial/w7/amd64/WdfCoInstaller01009.dll /tmp/iso/vioserial/2k8/amd64/WdfCoInstaller01009.dll
sudo rdfind -makehardlinks true /tmp/iso/
-
name: Build minified ISO
if: env.exists == 'false'
id: build
run: |
#!/bin/bash
cd /tmp/iso
genisoimage -o /tmp/virtio-win-${{ env.latest_base }}.iso -r -iso-level 4 -input-charset iso8859-1 -V "virtio-win-${{ env.latest_base }}" /tmp/iso
sudo rm /tmp/iso/*.msi
echo & echo
tar -C /tmp/iso -cvzf /tmp/virtio-win-${{ env.latest_base }}.tar.gz * >/dev/null
echo & echo
XZ_OPT=-9 tar -C /tmp/iso -Jcvf /tmp/virtio-win-${{ env.latest_base }}.tar.xz * >/dev/null
-
name: Checkout
if: env.exists == 'false'
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Create a release
if: env.exists == 'false'
uses: action-pack/github-release@v2
with:
tag: "v${{ env.latest_tag }}"
title: "v${{ env.latest_base }}"
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Update release
if: env.exists == 'false'
uses: AButler/[email protected]
with:
files: '/tmp/virtio-win-${{ env.latest_base }}.*'
release-tag: "v${{ env.latest_tag }}"
repo-token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Send mail
if: env.exists == 'false'
uses: action-pack/send-mail@v1
with:
to: ${{secrets.MAILTO}}
from: Github Actions <${{secrets.MAILTO}}>
connection_url: ${{secrets.MAIL_CONNECTION}}
subject: Build of ${{ github.event.repository.name }} v${{ env.latest_tag }} completed
body: |
The build job of ${{ github.event.repository.name }} v${{ env.latest_tag }} was completed successfully!
See https://github.com/${{ github.repository }}/actions for more information.