|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | 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: '' |
14 | 10 | host: |
15 | 11 | description: 'Target host' |
16 | 12 | type: choice |
|
29 | 25 | default: 'auto' |
30 | 26 |
|
31 | 27 | 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 | +
|
32 | 64 | build: |
| 65 | + needs: validate |
| 66 | + if: needs.validate.outputs.valid == 'true' |
33 | 67 | uses: ./.github/workflows/matrix_builds.yaml |
34 | 68 | with: |
35 | 69 | 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) }} |
38 | 72 | pkg-family: ${{ github.event.repository.name }} |
39 | 73 | rebuild: true |
40 | 74 | logs: true |
|
0 commit comments