Skip to content

Commit ee7019f

Browse files
committed
update
1 parent 16d14bb commit ee7019f

File tree

2 files changed

+52
-17
lines changed

2 files changed

+52
-17
lines changed

.github/workflows/manual-build.yaml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
recipe:
7-
description: 'Recipe path (e.g., binaries/hello/static.yaml)'
8-
type: choice
9-
options:
10-
- binaries/hello/static.yaml
11-
- binaries/jq/static.yaml
12-
- packages/hello-appimage/appimage.yaml
13-
default: 'binaries/hello/static.yaml'
7+
description: 'Recipe path (e.g., binaries/hello/static.yaml) or leave empty to list all'
8+
type: string
9+
default: ''
1410
host:
1511
description: 'Target host'
1612
type: choice
@@ -29,12 +25,50 @@ on:
2925
default: 'auto'
3026

3127
jobs:
28+
validate:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
recipe: ${{ steps.validate.outputs.recipe }}
32+
valid: ${{ steps.validate.outputs.valid }}
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Validate recipe
38+
id: validate
39+
run: |
40+
RECIPE="${{ inputs.recipe }}"
41+
42+
# Find all available recipes
43+
RECIPES=$(find binaries packages -name '*.yaml' -type f 2>/dev/null | sort)
44+
45+
if [ -z "$RECIPE" ]; then
46+
echo "::notice::No recipe specified. Available recipes:"
47+
echo "$RECIPES" | while read r; do echo " - $r"; done
48+
echo "valid=false" >> $GITHUB_OUTPUT
49+
exit 0
50+
fi
51+
52+
if [ ! -f "$RECIPE" ]; then
53+
echo "::error::Recipe not found: $RECIPE"
54+
echo ""
55+
echo "Available recipes:"
56+
echo "$RECIPES" | while read r; do echo " - $r"; done
57+
echo "valid=false" >> $GITHUB_OUTPUT
58+
exit 1
59+
fi
60+
61+
echo "recipe=$RECIPE" >> $GITHUB_OUTPUT
62+
echo "valid=true" >> $GITHUB_OUTPUT
63+
3264
build:
65+
needs: validate
66+
if: needs.validate.outputs.valid == 'true'
3367
uses: ./.github/workflows/matrix_builds.yaml
3468
with:
3569
host: ${{ inputs.host }}
36-
sbuild-url: "https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/${{ inputs.recipe }}"
37-
ghcr-url: ${{ contains(inputs.recipe, 'packages/') && format('ghcr.io/{0}/pkgcache', github.repository_owner) || format('ghcr.io/{0}/bincache', github.repository_owner) }}
70+
sbuild-url: "https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/${{ needs.validate.outputs.recipe }}"
71+
ghcr-url: ${{ contains(needs.validate.outputs.recipe, 'packages/') && format('ghcr.io/{0}/pkgcache', github.repository_owner) || format('ghcr.io/{0}/bincache', github.repository_owner) }}
3872
pkg-family: ${{ github.event.repository.name }}
3973
rebuild: true
4074
logs: true

.github/workflows/matrix_builds.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,22 @@ jobs:
210210
# Install Nix
211211
if ! command -v nix &>/dev/null; then
212212
curl -fsSL https://nixos.org/nix/install | sh -s -- --daemon --yes
213-
# Source nix
214-
if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
215-
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
216-
fi
217213
fi
214+
# Source nix environment
215+
if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
216+
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
217+
fi
218+
# Add nix to PATH for subsequent steps
219+
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
220+
echo "${HOME}/.nix-profile/bin" >> "$GITHUB_PATH"
218221
# Configure nix
219222
echo "access-tokens = github.com=${GITHUB_TOKEN}" | sudo tee -a /etc/nix/nix.conf
220-
export NIXPKGS_ALLOW_BROKEN=1
221-
export NIXPKGS_ALLOW_UNFREE=1
222-
export NIXPKGS_ALLOW_INSECURE=1
223-
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
223+
# Set environment variables
224224
echo "NIXPKGS_ALLOW_BROKEN=1" >> "$GITHUB_ENV"
225225
echo "NIXPKGS_ALLOW_UNFREE=1" >> "$GITHUB_ENV"
226226
echo "NIXPKGS_ALLOW_INSECURE=1" >> "$GITHUB_ENV"
227227
echo "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1" >> "$GITHUB_ENV"
228+
echo "NIX_INSTALLED=true" >> "$GITHUB_ENV"
228229
nix --version
229230
;;
230231

0 commit comments

Comments
 (0)