Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 20 additions & 36 deletions .github/workflows/license-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ jobs:
version: "22.04"
- distro: ubuntu
version: "24.04"
# Debian (DEB)
- distro: debian
version: "11"
- distro: debian
version: "12"
- distro: debian
version: "13"

steps:
- name: Checkout code
Expand All @@ -93,16 +100,11 @@ jobs:
run: uv sync --locked

- name: Generate ${{ matrix.distro }}-${{ matrix.version }} database
# License database generation involves downloading and parsing package metadata
# from distro repositories. Some distros (e.g., Ubuntu, Fedora) have very large
# package sets that can take 30-60+ minutes to process. The 120-minute timeout
# provides headroom for slower CI runners and network conditions.
run: |
uv run sbomify-license-db \
--distro ${{ matrix.distro }} \
--version ${{ matrix.version }} \
--output ${{ matrix.distro }}-${{ matrix.version }}.json.gz
timeout-minutes: 120

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -111,40 +113,22 @@ jobs:
path: ${{ matrix.distro }}-${{ matrix.version }}.json.gz
retention-days: 7

upload-to-release:
name: Upload to Release
runs-on: ubuntu-latest
needs: generate-databases
if: github.event_name == 'release'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: databases
pattern: license-db-*
merge-multiple: true

- name: List downloaded files
run: ls -la databases/
- name: Get release tag
id: get_tag
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
else
# For workflow_dispatch, get the latest release tag
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
fi
echo "Uploading to release: $(cat $GITHUB_OUTPUT | grep tag | cut -d= -f2)"

- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: databases/*.json.gz
tag_name: ${{ github.event.release.tag_name }}
files: ${{ matrix.distro }}-${{ matrix.version }}.json.gz
tag_name: ${{ steps.get_tag.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Summary
run: |
echo "## License Databases Uploaded" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The following license databases were uploaded to release ${{ github.event.release.tag_name }}:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for f in databases/*.json.gz; do
size=$(du -h "$f" | cut -f1)
name=$(basename "$f")
echo "- \`$name\` ($size)" >> $GITHUB_STEP_SUMMARY
done
Loading