release #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |