Skip to content

Package Cloud VM

Package Cloud VM #12

Workflow file for this run

name: Package Cloud VM
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
permissions:
contents: read
jobs:
vagrant-up:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install virtualbox and vagrant
run: brew install virtualbox vagrant
- name: Get latest version
id: get-version
run: |
TAG=$(git describe --tags --abbrev=0)
if ! [[ $TAG =~ ^v[0-9]{2}\.[0-9]{2}\.[0-9]{2}$ ]]; then
echo "Invalid tag name: '$TAG'"
exit 1
fi
echo "version=${TAG:1}" >> $GITHUB_OUTPUT
- name: Vagrant Up
run: CI=1 vagrant up
- name: Validate image
run: curl --show-error --fail --include http://localhost:1511
- name: Save image
run: vagrant package --output submitty.box
- name: Publish image
run: |
vagrant cloud auth login --token ${{ secrets.VAGRANT_CLOUD_TOKEN }}
vagrant cloud publish SubmittyBot/ubuntu22-dev ${{ steps.get-version.outputs.version }}.$(date +"%y%m%d%H%M") virtualbox submitty.box --release --force
vagrant cloud auth logout
- name: Acquire Job ID
if: failure()
id: get-job-id
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs)
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: Send zulip message on failure
if: failure()
run: |
curl -X POST https://submitty.zulipchat.com/api/v1/messages -u ${{ secrets.ZULIP_AUTHENTICATION }} \
--data-urlencode 'type=stream' \
--data-urlencode 'to=Submitty Developer Studio' \
--data-urlencode 'topic=Vagrant Up Failures' \
--data-urlencode 'content=The Package Vagrant VM Github Action has failed, this means the VM is not saved, and requires attention. View here: https://github.com/Submitty/Submitty/actions/runs/${{ github.run_id }}/job/${{ steps.get-job-id.outputs.job_id }}'