-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (59 loc) · 2.18 KB
/
release.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
---
name: release
# This workflow requires a VAGRANTCLOUD_TOKEN secret to be defined in the GitHub
# repository settings.
on:
push:
branches: [main]
paths:
- .github/workflows/release.yml
- playbook.yml
- requirements.yml
- Vagrantfile
schedule:
# Runs automatically on the 27th of every month at 05:30 UTC. This is
# because it has to run after https://github.com/dmotte/vagrant-ansiblebox
- cron: "30 05 27 * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
# We use this virtual environment because it supports nested virtualization.
# See https://github.com/actions/virtual-environments/issues/433 for more
# information
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Vagrant boxes
# Caches that are not accessed within the last week will be evicted
# (see https://github.com/actions/cache#cache-limits)
uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Set up Ansible
run: pip3 install ansible
- name: Vagrant base box update
run: vagrant box update
- name: Bring up the VM
run: vagrant up --provision
- name: Create the package.box file
run: vagrant package
- name: Destroy the VM
run: vagrant destroy -f
- name: Login to Vagrant Cloud
run: vagrant cloud auth login --token "${{ secrets.VAGRANTCLOUD_TOKEN }}"
- name: Publish the box to Vagrant Cloud
run: >
vagrant cloud publish
-s "Debian Vagrant box with Vagrant and VirtualBox for nested virtualization (github.com/dmotte/vagrant-vagrantbox)"
--version-description "This version has been released automatically with GitHub Actions, commit ${{ github.sha }}"
--no-private --release --force
dmotte/vagrantbox "$(date +%Y.%m.%d.%H%M)" virtualbox package.box