.github/workflows/build.yml #38
Workflow file for this run
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: | |
workflow_dispatch: | |
inputs: | |
builds: | |
description: 'Builds to build' | |
type: string | |
required: false | |
default: >- | |
[ | |
"ubuntu2310", | |
"fedora39", | |
"silverblue39", | |
"opensusetumbleweed", | |
"alpine319", | |
"alpine318", | |
"opensuseleap155", | |
"centos9s", | |
"debian12" | |
] | |
publish: | |
description: 'Publish to Vagrant Cloud' | |
type: boolean | |
default: false | |
required: false | |
env: | |
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} | |
PACKER_LOG: 1 | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
build: ${{ fromJSON(inputs.builds) }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: >- | |
wget -O- https://apt.releases.hashicorp.com/gpg | |
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
- run: >- | |
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 | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y --no-install-recommends packer qemu-system-x86 qemu-utils | |
- run: sudo apt-get clean -y | |
- run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
- run: sudo docker image prune --all --force | |
- run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- run: packer init . | |
- run: >- | |
packer build | |
-var version=0.${{ github.run_number }}.${{ github.run_attempt }} | |
${{ !inputs.publish && '-except vagrant-cloud' || '' }} | |
-only qemu.${{ matrix.build }} | |
. |