Files
naxos-os/.gitea/workflows/test-modules.yaml
T
Lukas Holzner bd1772482d
Test NaxOS Module Configurations / test-modules (push) Successful in 9m20s
feat(installer): deploy naxos-api, ui, and modules during install, and build ISO in CI
2026-09-04 09:54:08 +02:00

80 lines
3.1 KiB
YAML

name: Test NaxOS Module Configurations
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
packages: write
jobs:
test-modules:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Evaluate Flake Outputs & Check Syntax
run: |
nix flake show
nix eval .#nixosConfigurations.naxos.config.system.build.toplevel.drvPath
nix eval .#nixosConfigurations.installer-iso.config.system.build.isoImage.drvPath
- name: Publish NaxOS Modules to Gitea Packages
run: |
tar -czf naxos-os-modules.tar.gz modules profiles iso flake.nix flake.lock
echo "Packaging naxos-os-modules.tar.gz to Gitea Packages registry..."
TOKEN="${{ secrets.PACKAGE_TOKEN }}"
if [ -z "$TOKEN" ]; then
TOKEN="${{ secrets.GITEA_TOKEN }}"
fi
RESPONSE=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file naxos-os-modules.tar.gz \
"${{ github.server_url }}/api/packages/naxos/generic/naxos-os-modules/1.0.0/naxos-os-modules.tar.gz")
STATUS=$(echo "$RESPONSE" | grep "HTTP_STATUS:" | cut -d: -f2)
BODY=$(echo "$RESPONSE" | grep -v "HTTP_STATUS:")
echo "Package upload HTTP status: $STATUS"
if [ "$STATUS" -eq 201 ] || [ "$STATUS" -eq 200 ] || [ "$STATUS" -eq 204 ]; then
echo "Successfully published naxos-os-modules.tar.gz to Gitea Packages!"
elif [ "$STATUS" -eq 409 ]; then
echo "Package version 1.0.0 already published in Gitea Packages: $BODY"
else
echo "Failed to publish package to Gitea Packages ($STATUS): $BODY"
exit 1
fi
- name: Build & Publish Bootable Installer ISO
run: |
echo "Building NaxOS Bootable Installer ISO..."
nix build .#iso --option max-jobs auto
ISO_FILE=$(ls result/iso/*.iso | head -n 1)
echo "Built ISO image: $ISO_FILE ($(du -h "$ISO_FILE" | cut -f1))"
sha256sum "$ISO_FILE" > "$ISO_FILE.sha256"
TOKEN="${{ secrets.PACKAGE_TOKEN }}"
if [ -z "$TOKEN" ]; then
TOKEN="${{ secrets.GITEA_TOKEN }}"
fi
ISO_NAME=$(basename "$ISO_FILE")
echo "Publishing $ISO_NAME to Gitea Packages..."
curl -s -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$ISO_FILE" \
"${{ github.server_url }}/api/packages/naxos/generic/naxos-installer-iso/1.0.0/$ISO_NAME" || echo "ISO package already exists"
curl -s -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$ISO_FILE.sha256" \
"${{ github.server_url }}/api/packages/naxos/generic/naxos-installer-iso/1.0.0/$ISO_NAME.sha256" || echo "Checksum already exists"