From 40320087bbd50cdc918d010c22ec775c2a3246f6 Mon Sep 17 00:00:00 2001 From: Stephen Quoll Date: Mon, 9 Sep 2024 23:13:28 +1000 Subject: [PATCH] Updating build workflows --- .github/workflows/generate-proxmox-lxc.yml | 13 ++--- .github/workflows/generate-virtualbox-ova.yml | 56 +++++++++++++++++++ 2 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/generate-virtualbox-ova.yml diff --git a/.github/workflows/generate-proxmox-lxc.yml b/.github/workflows/generate-proxmox-lxc.yml index c35bb9d..9893fc5 100644 --- a/.github/workflows/generate-proxmox-lxc.yml +++ b/.github/workflows/generate-proxmox-lxc.yml @@ -34,20 +34,15 @@ jobs: run: | nix-channel --add https://github.com/dogeorg/dogebox-nur-packages/archive/main.tar.gz dogebox nix-channel --update - -# - name: nixos-rebuild based on configuration-builder.nix -# run: | -# nix-env --install nixos-rebuild -# sudo NIXOS_CONFIG=/home/runner/work/dogebox/dogebox/configuration-builder.nix nixos-rebuild switch - - - name: Generate NixOS configuration + + - name: Generate LXC image run: | - nix run github:nix-community/nixos-generators -- -f proxmox-lxc -c nix/pve.nix | { + NIX_PATH=$NIX_PATH:$(ls -d /nix/store/*dogebox/) nix run github:nix-community/nixos-generators -- -f proxmox-lxc -c nix/pve.nix | { read path echo "BUILD_PATH=$path" >> $GITHUB_ENV } - - name: Move the build artifact to a working directory. + - name: Move the build artifact to a working directory run: | NEW_FILENAME="$(basename ${{ env.BUILD_PATH }})" RELEASE_PATH="${{ github.workspace }}/$NEW_FILENAME" diff --git a/.github/workflows/generate-virtualbox-ova.yml b/.github/workflows/generate-virtualbox-ova.yml new file mode 100644 index 0000000..2d9dfe8 --- /dev/null +++ b/.github/workflows/generate-virtualbox-ova.yml @@ -0,0 +1,56 @@ +name: 'generate-proxmox-lxc' + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + #push: + # branches: [ "main" ] + #pull_request: + # branches: [ "main" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# The following permissions are required for softprops/action-gh-release@v1. +permissions: + contents: write + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + generate: + runs-on: ubuntu-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + - name: Install nix + uses: cachix/install-nix-action@v24 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-24.05 + + - name: Add dogebox channel + run: | + nix-channel --add https://github.com/dogeorg/dogebox-nur-packages/archive/main.tar.gz dogebox + nix-channel --update + + - name: Generate LXC image + run: | + NIX_PATH=$NIX_PATH:$(ls -d /nix/store/*dogebox/) nix run github:nix-community/nixos-generators -- -f virtualbox -c nix/vbox.nix | { + read path + echo "BUILD_PATH=$path" >> $GITHUB_ENV + } + + - name: Move the build artifact to a working directory + run: | + NEW_FILENAME="$(basename ${{ env.BUILD_PATH }})" + RELEASE_PATH="${{ github.workspace }}/$NEW_FILENAME" + cp "${{ env.BUILD_PATH }}" "$RELEASE_PATH" + echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV + + # Create a GitHub release and attach the generated container template. + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.RELEASE_PATH }}