Skip to content

Commit

Permalink
feat: expose aggregation of release.json(s) as workflow outputs (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh authored Jul 25, 2024
1 parent b0642bd commit e13e55c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
required: false
type: string
default: '["version.json"]'
outputs:
json:
description: JSON aggregation of release.json artifacts
value: ${{ toJSON(jobs.aggregate.outputs.json) }}

jobs:
release-check:
Expand Down Expand Up @@ -315,3 +319,22 @@ jobs:
with:
name: ${{ steps.json.outputs.name }}
path: release.json
aggregate:
needs: [release-check]
runs-on: ubuntu-latest
outputs:
json: ${{ steps.aggregate.outputs.json }}
steps:
- uses: actions/download-artifact@v4
- id: aggregate
run: |
echo "json<<EOF" >> $GITHUB_OUTPUT
echo "{" | tee -a $GITHUB_OUTPUT
for d in *; do
f="$d/release.json"
if [[ -d "$d" && -f "$f" ]]; then
echo "\"$d\": $(jq . "$f")" | tee -a $GITHUB_OUTPUT
fi
done
echo "}" | tee -a $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
23 changes: 23 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
required: false
type: string
default: '["version.json"]'
outputs:
json:
description: JSON aggregation of release.json artifacts
value: ${{ toJSON(jobs.aggregate.outputs.json) }}
secrets:
UCI_GITHUB_TOKEN:
required: false
Expand Down Expand Up @@ -152,3 +156,22 @@ jobs:
with:
name: ${{ steps.json.outputs.name }}
path: release.json
aggregate:
needs: [releaser]
runs-on: ubuntu-latest
outputs:
json: ${{ steps.aggregate.outputs.json }}
steps:
- uses: actions/download-artifact@v4
- id: aggregate
run: |
echo "json<<EOF" >> $GITHUB_OUTPUT
echo "{" | tee -a $GITHUB_OUTPUT
for d in *; do
f="$d/release.json"
if [[ -d "$d" && -f "$f" ]]; then
echo "\"$d\": $(jq . "$f")" | tee -a $GITHUB_OUTPUT
fi
done
echo "}" | tee -a $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Added
- aggregation of release.json artifacts as workflow outputs

## [1.0.6] - 2024-07-24
### Added
Expand Down

0 comments on commit e13e55c

Please sign in to comment.