Skip to content

Commit

Permalink
Supporting replacements in NightlyReleases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Dec 1, 2024
1 parent 4c28b9d commit 7733e89
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/NightlyRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ on:
required: false
default: false
type: boolean
replacements:
description: 'Multi-line string containing search=replace patterns.'
required: false
default: ''
type: string
assets:
description: 'Multi-line string containing artifact:file:title asset descriptions.'
required: true
Expand Down Expand Up @@ -170,6 +175,19 @@ jobs:
export GH_TOKEN=${{ github.token }}
Replace() {
line="$1"
while IFS=$'\r\n' read -r patternLine; do
# skipp empty lines
[[ "$patternLine" == "" ]] && continue
pattern="${patternLine%%=*}"
replacement="${patternLine#*=}"
line="${line//"%$pattern%"/"$replacement"}"
done <<<'${{ inputs.replacements }}'
echo "$line"
}
ERRORS=0
# A dictionary of 0/1 to avoid duplicate downloads
declare -A downloadedArtifacts
Expand All @@ -190,6 +208,10 @@ jobs:
asset="${asset#"${asset%%[![:space:]]*}"}"
title="${title#"${title%%[![:space:]]*}"}"
# apply replacements
asset="$(Replace "${asset}")"
title="$(Replace "${title}")"
echo "Publish asset '${asset}' from artifact '${artifact}' with title '${title}'"
echo -n " Checked asset for duplicates ... "
if [[ -n "${assetFilenames[$asset]}" ]]; then
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/_Checking_JobTemplates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev
needs:
- DocCoverage
with:
package_name: pyDummy

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/_Checking_Nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ jobs:
The following asset categories are provided for pyGHDL:
* Platform specific Python wheel package for Ubuntu incl. `pyGHDL...so`
* Platform specific Python wheel package for Windows incl. `pyGHDL...dll`
replacements: |
version=2.0
tool=myTool
prog=program
assets: |
document: document1.txt: Documentation
document: build.log: Logfile
other: document1.txt: SBOM
other: program.py: Application
document: build.log: Logfile - %tool% - %tool%
other: document1.txt: SBOM - %version%
other: %prog%.py: 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 7733e89

Please sign in to comment.