Skip to content

Commit

Permalink
feat: use artifcats to collect mutliple job outputs into one
Browse files Browse the repository at this point in the history
A matrix job cant have multiple outputs directly, see
https://github.com/orgs/community/discussions/17245.

Use the artifact workaround.
  • Loading branch information
dsp-ant committed Jan 13, 2025
1 parent 9f86ee5 commit 356a486
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
check-release:
needs: prepare
runs-on: ubuntu-latest
outputs:
release: ${{ steps.check.outputs.release }}
strategy:
matrix:
directory: ${{ fromJson(needs.prepare.outputs.matrix) }}
Expand All @@ -57,34 +55,49 @@ jobs:
- name: Check release
id: check
run: |
output=$(uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}" \
| grep -o -E "[a-zA-Z0-9\-]+@[0-9]+\.[0-9]+\.[0-9]+" || true)
dir_hash=$(echo "${{ matrix.directory }}" | sha256sum | awk '{print $1}')
output=$(uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}" | grep -o -E "[a-zA-Z0-9\-]+@[0-9]+\.[0-9]+\.[0-9]+" || true)
if [ ! -z "$output" ]; then
echo "release<<EOF" >> $GITHUB_OUTPUT
echo "$output" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
mkdir -p ./outputs
echo "$output" > "./outputs/${dir_hash}"
echo "upload_dir=./outputs/${dir_hash}" >> $GITHUB_OUTPUT
fi
- uses: actions/upload-artifact@v4
if: steps.check.outputs.upload_dir
with:
name: release-outputs-${{ matrix.directory }}
path: ${{ steps.check.outputs.upload_dir }}

check-tag:
needs: [prepare, check-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
pattern: release-outputs-*
merge-multiple: true
path: outputs

- name: Simulate tag creation
run: |
echo "${{ needs.check-release.outputs.release }}" > packages.txt
if [ -s packages.txt ]; then
DATE=$(date +%Y.%m.%d)
echo "πŸ” Dry run: Would create tag v${DATE} if this was a real release"
echo "# Release ${DATE}" > notes.md
echo "" >> notes.md
echo "## Updated Packages" >> notes.md
while IFS= read -r line; do
echo "- $line" >> notes.md
done < packages.txt
echo "πŸ” Would create release with following notes:"
cat notes.md
ls -lh outputs
if [ -d outputs ]; then
cat outputs/* > packages.txt
if [ -s packages.txt ]; then
DATE=$(date +%Y.%m.%d)
echo "πŸ” Dry run: Would create tag v${DATE} if this was a real release"
echo "# Release ${DATE}" > notes.md
echo "" >> notes.md
echo "## Updated Packages" >> notes.md
while IFS= read -r line; do
echo "- $line" >> notes.md
done < packages.txt
echo "πŸ” Would create release with following notes:"
cat notes.md
fi
fi

0 comments on commit 356a486

Please sign in to comment.