Skip to content

vm-provision

vm-provision #120

Workflow file for this run

name: vm-provision
on:
push:
branches:
- main
- 'testing/**'
- 'feature/**'
- 'hotfix/**'
# Run pipeline for release tags
tags:
- 'v*.*.*'
schedule:
# Weekly builds on Monday morning 4:42
# Github doc:
# "The schedule event can be delayed during periods of high loads of GitHub Actions workflow runs.
# High load times include the start of every hour.
# To decrease the chance of delay, schedule your workflow to run at a different time of the hour."
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '42 4 * * 1'
jobs:
vagrant-provision:
# Running on macOS, because macOS-based GitHub-hosted action runners do support nested virtualization.
# https://github.com/actions/runner-images/issues/433
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: install dependencies
run: |
brew install wget unzip gnu-tar gnu-sed
- name: show Vagrant version
run: vagrant --version
- name: run vagrant up
run: |
vagrant up
echo "=> Vagrant run finished."
env:
GITHUB_TOKEN: ${{ github.token }}
- name: export virtualbox VM
run: |
vagrant halt
vboxmanage export emoflon -o emoflon.ovf
sed -i -e '/<BIOS>/,/<\/BIOS>/d' emoflon.ovf
sed -i -e '/<RemoteDisplay enabled="true">/,/<\/RemoteDisplay>/d' emoflon.ovf
gtar -cvf emoflon.ova emoflon.ovf emoflon-disk001.vmdk
rm -rf emoflon.ovf emoflon-disk001.vmdk
# ^gtar (to use gnu-tar) instead of macOS tar
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: emoflon-ova
path: emoflon.ova
# Create a release if running on tag
create-release:
needs: [vagrant-provision]
runs-on: ubuntu-20.04
# Only run on pushed tags (and explicitely ignore scheduled runs)
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && github.event_name != 'schedule'
steps:
- name: collect artifacts
uses: actions/download-artifact@master
- name: create splitted ZIP archive
run: |
sudo apt-get install -yq zip
zip -r -s 1990m emoflon-vm.zip emoflon-ova/emoflon.ova
# Due to a bug in the release action, we have to upload all artifacts step-by-step
# https://github.com/softprops/action-gh-release/issues/243
- name: release emoflon-vm (1)
uses: softprops/action-gh-release@v1
with:
body: "The VM archive can not be directly added to this release because of the size limitation of 2GB per file. Please download the splitted ZIP archive and extract it manually."
files: emoflon-vm.zip
- name: release emoflon-vm (2)
uses: softprops/action-gh-release@v1
with:
body: "The VM archive can not be directly added to this release because of the size limitation of 2GB per file. Please download the splitted ZIP archive and extract it manually."
files: emoflon-vm.z01
- name: release emoflon-vm (3)
uses: softprops/action-gh-release@v1
with:
body: "The VM archive can not be directly added to this release because of the size limitation of 2GB per file. Please download the splitted ZIP archive and extract it manually."
files: emoflon-vm.z02