-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (46 loc) · 1.55 KB
/
vagrant-build.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
name: Build a release
# Source: https://github.com/jonashackt/vagrant-github-actions
on:
push:
branches:
- main
paths:
- 'version.txt'
workflow_dispatch:
jobs:
build-release:
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Vagrant boxes
uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Show Vagrant version
run: vagrant --version
- name: Show VirtualBox version
run: VBoxManage --version
- name: Build the environment
run: vagrant up
- name: Create a Vagrant box
run: vagrant package --vagrantfile Vagrantfile-in-box --output bgp-security-lab-$(cat version.txt).box
- name: Store box file
uses: actions/upload-artifact@v3
with:
name: vagrant-box
path: "bgp-security-lab-*.box"
- name: Publish box file in the release
if: startsWith(github.ref, 'refs/tags/')
uses: djn24/add-asset-to-release@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: "bgp-security-lab-*.box"
- name: Publish box file in the Vagrant Cloud
env:
ATLAS_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
run: vagrant cloud publish ripencc/bgpseclab $(cat version.txt) virtualbox bgp-security-lab-$(cat version.txt).box --force