Build & publish tinkerbell/pxe box #5
This file contains hidden or 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 & publish tinkerbell/pxe box | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version string written into metadata.json (e.g. 0.1.0)" | |
| required: true | |
| default: "0.1.0" | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| env: | |
| RELEASE_TAG: pxe-box-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| dosfstools mtools qemu-utils gdisk uuid-runtime | |
| - name: Compute BASE_URL | |
| id: base | |
| run: | | |
| echo "url=https://github.com/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Build all box artifacts | |
| run: | | |
| make -C stack/pxe-box \ | |
| NAME=tinkerbell/pxe \ | |
| VERSION='${{ inputs.version }}' \ | |
| BASE_URL='${{ steps.base.outputs.url }}' | |
| - name: Show outputs | |
| run: | | |
| ls -lh stack/pxe-box/out/ | |
| echo "--- metadata.json ---" | |
| cat stack/pxe-box/out/metadata.json | |
| - name: Remove previous rolling release & tag | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release delete "$RELEASE_TAG" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --cleanup-tag --yes || true | |
| - name: Publish to rolling GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| target_commitish: ${{ github.sha }} | |
| name: "tinkerbell/pxe (rolling)" | |
| make_latest: "false" | |
| prerelease: false | |
| draft: false | |
| body: | | |
| Rolling release of the `tinkerbell/pxe` Vagrant box. | |
| - version in `metadata.json`: `${{ inputs.version }}` | |
| - commit: `${{ github.sha }}` | |
| - built by: ${{ github.workflow }} (${{ github.run_id }}) | |
| `metadata.json` is published to GitHub Pages — Vagrant requires | |
| a `Content-Type: application/json` response, which Release assets | |
| cannot provide (they're served as `application/octet-stream`). | |
| Use it from a `Vagrantfile`: | |
| ```ruby | |
| config.vm.box = "tinkerbell/pxe" | |
| config.vm.box_url = "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pxe-box/metadata.json" | |
| ``` | |
| files: | | |
| stack/pxe-box/out/pxe-amd64-virtualbox.box | |
| stack/pxe-box/out/pxe-arm64-virtualbox.box | |
| stack/pxe-box/out/pxe-amd64-libvirt.box | |
| stack/pxe-box/out/pxe-arm64-libvirt.box | |
| - name: Stage metadata.json for GitHub Pages | |
| run: | | |
| mkdir -p pages-publish/pxe-box | |
| cp stack/pxe-box/out/metadata.json pages-publish/pxe-box/metadata.json | |
| - name: Publish metadata.json to gh-pages branch | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: pages-publish | |
| publish_branch: gh-pages | |
| keep_files: true | |
| commit_message: "pxe-box: publish metadata.json (${{ github.sha }})" |