-
Notifications
You must be signed in to change notification settings - Fork 6
73 lines (61 loc) · 2.38 KB
/
build-virtual-machine.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
# Builds rack-box virtual machine (reusable workflow)
on:
workflow_call:
inputs:
version:
required: false
default: 'dev'
type: string
jobs:
# build-virtual-machine job:
# - Downloads rack-box files from artifacts
# - Builds rack-box virtual machine
# - Uploads virtual machine to artifacts or releases
build-virtual-machine:
runs-on: macos-12
steps:
- name: Check out RACK source
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK
path: RACK
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
- name: Download base box for virtual machine
run: |
curl -LOSfs https://app.vagrantup.com/ubuntu/boxes/jammy64/versions/20230215.0.0/providers/virtualbox.box
mkdir -p RACK/rack-box/jammy64
tar -xf virtualbox.box -C RACK/rack-box/jammy64
rm -f virtualbox.box
- name: Build rack-box virtual machine
run: |
cd RACK/rack-box
packer build -var headless=true -var version=${{ inputs.version }} rack-box-virtualbox.json
- name: Split rack-box virtual machine
run: |
cd RACK/rack-box
mv output-virtualbox-ovf rack-box-${{ inputs.version }}
zip -r rack-box-${{ inputs.version }}.zip rack-box-${{ inputs.version }}
split -b 1500m rack-box-${{ inputs.version }}.zip rack-box-${{ inputs.version }}.zip
rm rack-box-${{ inputs.version }}.zip
- name: Upload virtual machine to artifacts
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
name: rack-box-${{ inputs.version }}
path: |
RACK/rack-box/GitHub-Release-README.md
RACK/rack-box/rack-box-${{ inputs.version }}.zip*
# softprops/action-gh-release has many issues and PRs filed
# against it; replace it with "gh release upload" if CI fails
# run: gh release upload ${{ github.event.release.tag_name }} RACK/rack-box/GitHub-Release-README.md RACK/rack-box/rack-box-${{ inputs.version }}.zip* --clobber
- name: Upload virtual machine to releases
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
RACK/rack-box/GitHub-Release-README.md
RACK/rack-box/rack-box-${{ inputs.version }}.zip*