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
72 changes: 70 additions & 2 deletions .github/workflows/sync-purls.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Collect latest PURLs from FederatedCode
name: Collect latest PURLs from FederatedCode and create release with latest FST

on:
workflow_dispatch:
Expand All @@ -11,7 +11,7 @@ permissions:
jobs:
collect-purls:
strategy:
max-parallel: 4
max-parallel: 1
matrix:
include:
- ecosystem: apk
Expand All @@ -31,3 +31,71 @@ jobs:
with:
ecosystem: ${{ matrix.ecosystem }}
path: "fst_builder/data/${{ matrix.ecosystem }}.txt"

regen-fst-and-release:
name: Regenerate FST and create release using new FST
needs: collect-purls
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TAG_RELEASE_TOKEN }}

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-edit
run: cargo install cargo-edit

- name: Regenerate FST
id: regen_fst
run: |-
git pull
make build-fst
git diff --name-only | grep -q 'purls.fst' && echo "changed=true" >> $GITHUB_OUTPUT \
|| echo "changed=false" >> $GITHUB_OUTPUT

# Commit latest FST
git config user.name "AboutCode Automation"
git config user.email "automation@aboutcode.org"
git add purls.fst
git commit -m "$(echo -e "Regenerate FST using latest PURLs\n\nSigned-off-by: AboutCode Automation <automation@aboutcode.org>")" || exit 0
git push

- name: Bump minor version
id: bump
if: steps.regen_fst.outputs.changed == 'true'
run: |-
output=$(cargo set-version --bump minor 2>&1)
new_version=$(echo "$output" | awk '{print $NF}')

echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Add Changelog
if: steps.regen_fst.outputs.changed == 'true'
run: |-
# Add Changelog
today=$(date +%Y-%m-%d)
awk -v ver="${{ steps.bump.outputs.new_version }}" -v date="$today" '
NR==1{
print "# Changelog\n\n## v" ver " (" date ")\n\n - Update FST with latest PURLs"
next
}1' CHANGELOG.md > .tmp.CHANGELOG.md && mv .tmp.CHANGELOG.md CHANGELOG.md

- name: Commit Changelog and Lock files
if: steps.regen_fst.outputs.changed == 'true'
run: |-
# Commit Changelog and Lock files
git config user.name "AboutCode Automation"
git config user.email "automation@aboutcode.org"
git add -A
git commit -m "$(echo -e "Bump version for v${{ steps.bump.outputs.new_version }} release\n\nSigned-off-by: AboutCode Automation <automation@aboutcode.org>")" || exit 0
git push

- name: Push tag
if: steps.regen_fst.outputs.changed == 'true'
run: |-
# Push tag
git tag -a "v${{ steps.bump.outputs.new_version }}" -m "Release v${{ steps.bump.outputs.new_version }}"
git push origin "v${{ steps.bump.outputs.new_version }}"
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@

## Currently Supported Ecosystems

- **nuget**: [https://www.nuget.org/](https://www.nuget.org/)
- **apk**
- **cargo**
- **composer**
- **conan**
- **cpan**
- **cran**
- **debain**
- **maven**
- **npm**
- **nuget**
- **pypi**
- **swift**

## Usage

Expand Down