Merge pull request #6 from Uninett/test-ubuntu-build #108
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: Build NAV appliance | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
packer: | |
name: "Build appliance using Packer" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
PACKER_LOG: 0 | |
PACKER_CACHE: .cache/packer | |
PACKER_GITHUB_API_TOKEN: ${{ secrets.PACKER_GITHUB_API_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install required packages from Ubuntu | |
run: | | |
sudo apt-get install -y virtualbox gnupg | |
- name: Install Packer | |
run: | | |
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
sudo apt-get update && sudo apt-get install -y packer | |
- name: Create packer cache directory | |
run: | | |
mkdir -p $PACKER_CACHE | |
- name: Get ISO checksums | |
id: get-checksum | |
run: | | |
echo "checksum=$(cat bullseye.json | jq '.builders[].iso_checksum')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: "Cache downloaded packer images" | |
uses: actions/cache/save@v3 | |
if: always() | |
id: packer-cache | |
with: | |
path: .cache/packer | |
key: ${{ steps.get-checksum.outputs.checksum }} | |
- name: Install virtualbox plugin | |
run: | | |
packer plugins install github.com/hashicorp/virtualbox | |
- name: Validate Template | |
run: | | |
packer validate bullseye.json | |
- name: Build Appliance Artifact | |
timeout-minutes: 22 | |
run: | | |
packer build bullseye.json | |
- name: Upload video artifact | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: video | |
path: | | |
**/*.webm | |
- name: Upload appliance artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: navappliance | |
path: | | |
navappliance/**/* |