|
17 | 17 | required: false |
18 | 18 | default: "" |
19 | 19 | type: string |
20 | | - max_versions: |
21 | | - description: Maximum number of version tags to build for this manual run |
22 | | - required: false |
23 | | - default: "1" |
24 | | - type: string |
25 | 20 |
|
26 | 21 | env: |
27 | 22 | IMAGE_NAME: ${{ inputs.image_name || vars.IMAGE_NAME || 'nikolaik/python-nodejs' }} |
|
36 | 31 | runs-on: ubuntu-latest |
37 | 32 | needs: [test] |
38 | 33 | outputs: |
39 | | - version_matrix: ${{ steps.filter-matrix.outputs.version_matrix }} |
40 | | - arch_matrix: ${{ steps.filter-matrix.outputs.arch_matrix }} |
| 34 | + version_matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 35 | + arch_matrix: ${{ steps.set-matrix.outputs.arch_matrix }} |
41 | 36 | steps: |
42 | 37 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
43 | 38 | with: |
|
50 | 45 | run: | |
51 | 46 | FORCE=$(if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force }}" == "true" ]]; then echo "--force"; elif git log --pretty=format:"%s" HEAD^..HEAD | grep -q '\[force\]'; then echo "--force"; else echo ""; fi) |
52 | 47 | uv run dpn $FORCE build-matrix --event ${{ github.event_name }} |
53 | | - - name: Filter build matrix for manual runs |
54 | | - id: filter-matrix |
55 | | - run: | |
56 | | - version_matrix='${{ steps.set-matrix.outputs.matrix }}' |
57 | | - arch_matrix='${{ steps.set-matrix.outputs.arch_matrix }}' |
58 | | - max_versions='${{ github.event_name == 'workflow_dispatch' && inputs.max_versions || '0' }}' |
59 | | -
|
60 | | - if [[ -z "${version_matrix}" ]]; then |
61 | | - echo "version_matrix=" >> "$GITHUB_OUTPUT" |
62 | | - echo "arch_matrix=" >> "$GITHUB_OUTPUT" |
63 | | - exit 0 |
64 | | - fi |
65 | | -
|
66 | | - filtered_version_matrix="$(jq -cn \ |
67 | | - --argjson matrix "${version_matrix}" \ |
68 | | - --arg max_versions "${max_versions}" ' |
69 | | - ($matrix.include |
70 | | - | if ($max_versions | tonumber) > 0 then .[:($max_versions | tonumber)] else . end |
71 | | - ) as $include |
72 | | - | if ($include | length) == 0 then empty else {include: $include} end |
73 | | - ')" |
74 | | -
|
75 | | - if [[ -z "${filtered_version_matrix}" ]]; then |
76 | | - echo "version_matrix=" >> "$GITHUB_OUTPUT" |
77 | | - echo "arch_matrix=" >> "$GITHUB_OUTPUT" |
78 | | - exit 0 |
79 | | - fi |
80 | | -
|
81 | | - filtered_arch_matrix="$(jq -cn \ |
82 | | - --argjson matrix "${arch_matrix}" \ |
83 | | - --argjson selected "${filtered_version_matrix}" ' |
84 | | - ($selected.include | map(.key)) as $keys |
85 | | - | {include: ($matrix.include | map(select(.key as $key | $keys | index($key))))} |
86 | | - ')" |
87 | | -
|
88 | | - echo "version_matrix=${filtered_version_matrix}" >> "$GITHUB_OUTPUT" |
89 | | - echo "arch_matrix=${filtered_arch_matrix}" >> "$GITHUB_OUTPUT" |
90 | 48 |
|
91 | 49 |
|
92 | 50 | build-arch: |
|
0 commit comments