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
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
PACKER_GITHUB_API_TOKEN: "${{ secrets.BENTO_TOKEN }}" | |
# PACKER_LOG: 1 | |
jobs: | |
x86_64: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
# - ubuntu-24.04 | |
provider: | |
- virtualbox-iso | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Install Vagrant VirtualBox | |
run: | | |
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor | sudo tee /usr/share/keyrings/oracle-virtualbox-2016.gpg | |
echo "deb [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 | |
echo "deb [signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common vagrant virtualbox-7.0 | |
- name: Install Chef | |
uses: actionshub/[email protected] | |
with: | |
version: 24.2.1058 | |
- name: Setup Packer | |
uses: hashicorp/setup-packer@main | |
with: | |
version: latest | |
- name: Install Bento | |
run: | | |
eval "$(chef shell-init bash)" | |
gem build bento.gemspec | |
gem install bento-*.gem | |
- name: Bento build | |
run: | | |
rm -rf builds | |
sudo mkdir -p /mnt/builds/iso | |
sudo chmod -R 777 /mnt/builds | |
sudo ln -s /mnt/builds ./ | |
eval "$(chef shell-init bash)" | |
export LOGNAME=$USER | |
bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" | |
ls -alh builds/ | |
cat builds/${{ matrix.os }}*-x86_64._metadata.json | |
- name: Upload build artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: "${{ matrix.os }}-virtualbox-x86_64" | |
path: | | |
builds/*.box | |
builds/*.json | |
retention-days: 10 | |
compression-level: 0 # no compression | |
- name: Bento Test | |
run: | | |
eval "$(chef shell-init bash)" | |
export LOGNAME=$USER | |
bento test |