Build #37
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: Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '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 tag | |
run: | | |
#!/bin/bash | |
latest_tag="0.1.240" | |
[ -z "$latest_tag" ] && echo "Tag not found!" && exit 1 | |
[[ "$latest_tag" == "null" ]] && echo "Tag not found!" && exit 1 | |
[[ "$latest_tag" = v* ]] && latest_tag="${latest_tag:1}" | |
echo "Found tag: \"${latest_tag}\"" | |
echo "latest_tag=$latest_tag" >> $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 | |
if [[ "${{ steps.checkTag.outputs.exists }}" == "true" ]]; then | |
echo "exists=true" >> $GITHUB_ENV | |
exit 0 | |
fi | |
loc="${{ env.latest_tag }}" | |
url="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-${loc}-1" | |
echo "Checking if ${url} exists.." | |
resp=$(curl -I 2>/dev/null $url | head -1) | |
if echo $resp | grep 404 >/dev/null; then | |
echo "exists=true" >> $GITHUB_ENV | |
else | |
echo "exists=false" >> $GITHUB_ENV | |
fi | |
- | |
name: Build minified ISO | |
if: env.exists == 'false' | |
id: version | |
run: | | |
#!/bin/bash | |
sudo apt install genisoimage | |
rm -f /tmp/latest.iso | |
wget "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-${{ env.latest_tag }}-1/virtio-win-${{ env.latest_tag }}.iso" -O "/tmp/latest.iso" -q | |
rm -rf /tmp/iso && mkdir /tmp/iso | |
7z x "/tmp/latest.iso" -o/tmp/iso | |
cd /tmp/iso | |
echo & echo | |
# Remove tools for different 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 -name "*.pdb" -type f -delete | |
sudo find /tmp/iso -name "*.PDB" -type f -delete | |
# Remove binaries | |
sudo find /tmp/iso -name "ARM64" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "Arm64" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "arm64" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "xp" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "XP" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "x86" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "X86" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "*2k3*" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "*2k8*" -type d -exec rm -rf {} + | |
sudo find /tmp/iso -name "*2k12*" -type d -exec rm -rf {} + | |
echo & echo | |
#mkzftree -z 9 -p 4 --one-filesystem /tmp/iso /tmp/isoc | |
genisoimage -o /tmp/out.iso -r -z -iso-level 4 -no-pad -input-charset iso8859-1 -V "virtio-win-${{ env.latest_tag }}" /tmp/iso | |
mv /tmp/out.iso /tmp/virtio-win-${{ env.latest_tag }}.iso | |
- | |
name: Checkout | |
if: env.exists == 'false' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Create artifact | |
if: env.exists == 'false' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: virtio-win-${{ env.latest_tag }}.iso | |
path: /tmp/virtio-win-${{ env.latest_tag }}.iso | |
- | |
name: Create a release | |
if: env.exists == 'false' | |
uses: action-pack/github-release@v2 | |
with: | |
tag: "v${{ env.latest_tag }}" | |
title: "v${{ env.latest_tag }}" | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
- | |
name: Update release | |
if: env.exists == 'false' | |
uses: AButler/[email protected] | |
with: | |
files: '/tmp/virtio-win-${{ env.latest_tag }}.iso' | |
release-tag: "v${{ env.latest_tag }}" | |
repo-token: ${{ secrets.REPO_ACCESS_TOKEN }} |