name: Build the boxes "on": workflow_dispatch: jobs: collect: name: Discover distros runs-on: ubuntu-latest outputs: distros: ${{ steps.distros.outputs.distros }} steps: - uses: actions/checkout@v3 - name: Discover boxes id: distros run: |- set -eo pipefail distros=$(ls distros/*.hcl | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]') echo "::set-output name=distros::${distros}" build: name: Build box runs-on: ubuntu-latest needs: - collect strategy: fail-fast: false matrix: distro: ${{ fromJson( needs.collect.outputs.distros ) }} needs_timeout: - distros/ubuntu-20.04-x86_64.pkrvars.hcl steps: - uses: ./.github/actions/setup with: ansible: true - uses: ./.github/actions/install_packer - uses: greg-hellings/make-space@main - name: modify build timeouts, if necessary if: contains(matrix.needs_timeout, matrix.distro) shell: bash run: ./modify_timeout.sh "${{ matrix.distro }}" - name: try build shell: bash run: | set -e # Add a retry in case something bogus like a network failure happens ./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources || \ ./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources env: VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} PACKER_LOG: ${{ contains(matrix.needs_timeout, matrix.distro) && '1' || '0' }}