Update .forgejo/workflows/build-images.yaml
This commit is contained in:
parent
37ee355607
commit
4d386acca8
1 changed files with 12 additions and 23 deletions
|
@ -26,7 +26,10 @@ jobs:
|
|||
run: |
|
||||
# Path to the directory with metadata.yaml
|
||||
context_dir="/workspace/pub/containers/apps/${{ github.event.inputs.app }}"
|
||||
metadata_file="${context_dir}/metadata.yaml"
|
||||
metadata_file="$context_dir/metadata.yaml"
|
||||
|
||||
ls -lhart /workspace/pub/containers/apps/
|
||||
ls -lhart /workspace/pub/containers/apps/home-assistant
|
||||
|
||||
# If metadata.yaml doesn't exist, fail early.
|
||||
if [ ! -f "$metadata_file" ]; then
|
||||
|
@ -34,36 +37,23 @@ jobs:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# We want a JSON array of objects like:
|
||||
# [
|
||||
# {"channel":"stable","platform":"linux/amd64"},
|
||||
# {"channel":"beta","platform":"linux/amd64"},
|
||||
# {"channel":"beta","platform":"linux/arm64"}
|
||||
# ]
|
||||
# We'll parse channels[].name and channels[].platforms[].
|
||||
|
||||
echo "Parsing channels from $metadata_file..."
|
||||
|
||||
# We'll produce a JSON array using yq + bash:
|
||||
# for each channel in .channels[], take channel.name as "channel",
|
||||
# and for each p in channel.platforms, create an object { channel, platform }.
|
||||
# You can do it purely in yq or mix with shell logic. Here's one example:
|
||||
|
||||
# First, get the total channel count:
|
||||
channel_count=$(yq e '.channels | length' "$metadata_file")
|
||||
channel_count=$(cat "$metadata_file" | yq '.channels | length')
|
||||
|
||||
# We'll build the array in bash:
|
||||
result="["
|
||||
for i in $(seq 0 $((channel_count - 1))); do
|
||||
channel_name=$(yq e ".channels[$i].name" "$metadata_file")
|
||||
channel_name=$(cat "$metadata_file" | yq ".channels[$i].name" )
|
||||
# Number of platforms in this channel:
|
||||
platform_count=$(yq e ".channels[$i].platforms | length" "$metadata_file")
|
||||
platform_count=$(cat "$metadata_file" | yq ".channels[$i].platforms | length")
|
||||
|
||||
for j in $(seq 0 $((platform_count - 1))); do
|
||||
platform=$(yq e ".channels[$i].platforms[$j]" "$metadata_file")
|
||||
platform=$(cat "$metadata_file" | yq ".channels[$i].platforms[$j]")
|
||||
|
||||
# Append JSON object
|
||||
result="${result}{\"channel\":\"${channel_name}\",\"platform\":\"${platform}\"},"
|
||||
result="${result}{\"channel\":${channel_name},\"platform\":${platform}},"
|
||||
done
|
||||
done
|
||||
# Remove trailing comma
|
||||
|
@ -89,10 +79,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- run: echo "Channel is ${{ matrix.channel }} and platform is ${{ matrix.platform }}"
|
||||
- name: Debug matrix
|
||||
run: |
|
||||
echo "Matrix from check-matrix: ${{ needs.check-matrix.outputs.matrix }}"
|
||||
- id: set-context
|
||||
name: Determine Context
|
||||
run: |
|
||||
|
@ -108,6 +94,9 @@ jobs:
|
|||
echo "Version: $version"
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- run: echo "Channel is ${{ matrix.channel }} and platform is ${{ matrix.platform }}"
|
||||
- run: echo "Channel is ${{ matrix }}"
|
||||
|
||||
- name: Build and Push with Kaniko
|
||||
uses: https://code.252.no/pub/kaniko-action@latest
|
||||
with:
|
||||
|
|
Loading…
Reference in a new issue