feat: add vyos script, general cleanup/updates #44
Workflow file for this run
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: image-build | |
| # Controls when the workflow will run | |
| on: | |
| # Trigger on push or pull request to main branch | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| # Allow manual run from Actions tab | |
| workflow_dispatch: | |
| # Scheduled run every Wednesday at 11:11 UTC | |
| schedule: | |
| - cron: "11 11 * * WED" | |
| jobs: | |
| # Job: Save minicc and minirouter as artifacts for later use in image builds | |
| get-miniccc: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/sandialabs/sceptre-phenix/minimega:main | |
| steps: | |
| # Upload binaries as artifact named 'miniexes' | |
| - name: upload miniccc and minirouter | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: miniexes | |
| path: | | |
| /opt/minimega/bin/miniccc | |
| /opt/minimega/bin/minirouter | |
| # Job: Build images using the phenix image builder | |
| build-images: | |
| strategy: | |
| matrix: | |
| build: [bookworm, kali, jammy, noble, bennu, docker-hello-world, ntp, vyos] | |
| needs: get-miniccc | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/sandialabs/sceptre-phenix/phenix:main | |
| options: --privileged # needed for kernel device-mapper permissions | |
| steps: | |
| # Install oras CLI for pushing images to OCI registries | |
| - name: oras install | |
| uses: oras-project/setup-oras@v1 | |
| # Checkout repository code | |
| - uses: actions/checkout@v4 | |
| # Download miniexes artifact (miniccc and minirouter) | |
| - name: get miniexes | |
| uses: actions/download-artifact@v4.1.8 | |
| with: | |
| name: miniexes | |
| # Add the miniccc binary to the filesystem for image build. This is used | |
| # at the end of the image builds via `phenix image inject-miniexe ...` | |
| - name: add miniccc | |
| run: | | |
| mkdir /phenix/ | |
| cp ./miniccc /phenix/ | |
| chmod +x /phenix/miniccc | |
| # Build the image using phenix | |
| - name: ${{ matrix.build }} image build | |
| run: make ${{ matrix.build }} | |
| # Publish the built image to GitHub Container Registry using oras | |
| - name: publish package with oras | |
| # Only push package if on the default branch (e.g., main) | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| shell: bash | |
| run: | | |
| oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
| oras push "ghcr.io/${{ github.repository }}/bennu.qc2:${GITHUB_SHA:0:7}" ${{ matrix.build }}.qc2 | |
| # Job: Tag images after successful builds | |
| tag-images: | |
| strategy: | |
| matrix: | |
| build: [bookworm, kali, jammy, noble, bennu, docker-hello-world, ntp, vyos] | |
| # Only run on main branch for scheduled or manual workflow_dispatch events | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | |
| needs: build-images | |
| runs-on: ubuntu-latest | |
| outputs: | |
| date: ${{ steps.date.outputs.value }} | |
| steps: | |
| # Get current date for tagging | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
| # Install oras CLI | |
| - name: oras install | |
| uses: oras-project/setup-oras@v1 | |
| # Tag images in the registry with 'latest' and date-based tags | |
| - name: tag images with date and latest | |
| run: | | |
| oras version | |
| oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
| oras tag ghcr.io/${{ github.repository }}/${{ matrix.build }}.qc2:${GITHUB_SHA:0:7} latest ${{ steps.date.outputs.date }} | |
| # Job: Create release successful build | |
| release: | |
| # Only run on main branch for scheduled or manual workflow_dispatch events | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | |
| needs: tag-images | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Create a GitHub release with notes and usage instructions | |
| - name: create release | |
| uses: ncipollo/release-action@v1.15.0 | |
| with: | |
| name: release-${{ needs.tag-images.outputs.date }} | |
| body: | | |
| Images can be downloaded from the registry using the oras client: https://oras.land/docs/installation | |
| e.g.: | |
| ```bash | |
| oras pull ghcr.io/${{ github.repository }}/bennu.qc2:latest | |
| ``` | |
| You can view the available image builds from the [Package List](https://github.com/orgs/${{ github.repository_owner }}/packages?repo_name=${{ github.event.repository.name }}) | |
| tag: release-${{ needs.tag-images.outputs.date }} | |
| commit: main | |
| generateReleaseNotes: true | |
| makeLatest: true |