.github/workflows/build.yml #35
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 debian-archive-keyring ca-certificates | |
- run: >- | |
echo | |
"deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] https://ftp.debian.org/debian/ trixie main" | |
| sudo tee /etc/apt/sources.list.d/trixie.list | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y --no-install-recommends -t trixie qemu-system-x86 qemu-utils | |
- run: sudo apt-get clean -y | |
- run: packer init . | |
- run: >- | |
packer build | |
-var version=0.${{ github.run_number }}.${{ github.run_attempt }} | |
${{ !inputs.publish && '-except vagrant-cloud' || '' }} | |
-only qemu.${{ matrix.build }} | |
. |