-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (84 loc) · 3.41 KB
/
vagrant-up.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 self-hosted system(s), because GitHub-hosted action runners did break too often.
# https://github.com/actions/runner-images/issues/433
runs-on:
group: Default
labels: [self-hosted, Linux, X64]
steps:
- name: clean up old VMs
run: |
vboxmanage list vms | \
grep -o -P '(?<={).*(?=})' | \
while read line ; do vboxmanage unregistervm $line --delete ; done
- uses: actions/checkout@v4
- 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
tar -cvf emoflon.ova emoflon.ovf emoflon-disk001.vmdk
rm -rf emoflon.ovf emoflon-disk001.vmdk
- name: upload artifact
uses: actions/upload-artifact@v4
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