Skip to content

Commit

Permalink
Take inventory categories from input parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 14, 2025
1 parent f61b77e commit c3b7b3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/NightlyRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ on:
type: string
required: false
default: ''
inventory-categories:
type: string
required: false
default: ''
tarball-name:
type: string
required: false
Expand Down Expand Up @@ -214,7 +218,16 @@ jobs:
# Create JSON inventory
if [[ "${{ inputs.inventory-json }}" != "" ]]; then
VERSION="1.0"
ORDER=("os-name" "os-version" "os-arch" "runtime" "ghdl-backend")
# Split categories by ',' into a Bash array.
# See https://stackoverflow.com/a/45201229/3719459
if [[ "${{ inputs.inventory-categories }}" != "" ]]; then
readarray -td, inventoryCategories <<<"${{ inputs.inventory-categories }},"
unset 'inventoryCategories[-1]'
declare -p inventoryCategories
else
inventoryCategories=""
fi
jsonInventory=$(jq -c -n \
--arg version "${VERSION}" \
Expand All @@ -224,14 +237,14 @@ jobs:
--arg version "${{ inputs.inventory-version }}" \
--arg hash "${{ github.sha }}" \
--arg repo "${{ github.server_url }}/${{ github.repository }}" \
'{"tag": $tag, "version": $version, "git-hash": $hash, "repository-url": $repo}' \
)" \
--argjson jsonInfo "$(jq -c -n \
--arg url "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ inputs.nightly_name }}" \
--argjson order "$(jq -c -n '$ARGS.positional' --args "${ORDER[@]}")" \
'{"release-url": $url, "categories": $order}'
--arg release "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ inputs.nightly_name }}" \
--argjson categories "$(jq -c -n \
'$ARGS.positional' \
--args "${inventoryCategories[@]}" \
)" \
'{"tag": $tag, "version": $version, "git-hash": $hash, "repository-url": $repo, "release-url": $release, "categories": $categories}' \
)" \
'{"version": 1.0, "timestamp": $date, "meta": $jsonMeta, "info": $jsonInfo, "files": {}}'
'{"version": 1.0, "timestamp": $date, "meta": $jsonMeta, "files": {}}'
)
fi
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/_Checking_Nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ jobs:
* iventory.json
inventory-json: "inventory.json"
inventory-version: 4.2.5
# inventory-categories:
inventory-categories: "kind1,kind2"
assets: |
document: document1.txt: doc;html: Documentation
document: build.log: build;log: Logfile - %tool% - %tool%
other: document1.txt: build;SBOM:SBOM - %version%
other: %prog%.py: app;binary:Application - %tool% - %version%
document: document1.txt: doc,html: Documentation
document: build.log: build,log: Logfile - %tool% - %tool%
other: document1.txt: build,SBOM:SBOM - %version%
other: %prog%.py: app,binary:Application - %tool% - %version%
document:!archive1.zip: Archive 1 - zip
document:!archive2.tgz: Archive 2 - tgz
document:!archive3.tar.gz: Archive 3 - tar.gz
Expand Down

0 comments on commit c3b7b3c

Please sign in to comment.