Skip to content

Commit

Permalink
ci: fix osv data generation
Browse files Browse the repository at this point in the history
  • Loading branch information
blackheaven committed Mar 29, 2024
1 parent 53bfdde commit a8fa994
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ jobs:
run: |
! find advisories -type f -name '*.md' -print0 \
| xargs -0n1 basename | sort | uniq -c | grep -E -v '[[:space:]]*1 '
- name: Publish OSV data
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && github.repository == 'haskell/security-advisories' }}
env:
GITHUB_SHA: ${{ github.sha }}
- name: Generate OSV data
run: |
DATA_DIR=$PWD/osv
mkdir "$DATA_DIR"
while read FILE ; do
echo -n "$FILE: "
ID=$(basename "$FILE" .md)
YEAR=$(echo "$ID" | cut -d - -f 2)
mkdir -p $DATA_DIR/$YEAR
docker run --rm -v $PWD:/repo --workdir /repo haskell/hsec-tools:latest /bin/hsec-tools osv "$FILE" > $DATA_DIR/$YEAR/$ID.json
done < <(find advisories -type f -name "*.md")
done < <(find advisories -type f -name "*.md" | grep -v '^advisories/reserved/')
- name: Publish OSV data
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && github.repository == 'haskell/security-advisories' }}
env:
GITHUB_SHA: ${{ github.sha }}
run: |
BRANCH=generated/osv-export
REF=refs/remotes/origin/$BRANCH
export GIT_WORK_TREE=$DATA_DIR
Expand All @@ -74,13 +77,12 @@ jobs:
COMMIT=$(git commit-tree "$TREE" -p "$REF" -m "$(date --utc --rfc-3339=seconds) ($GITHUB_SHA)")
git push origin $COMMIT:$BRANCH
- name: Generate the website
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && github.repository == 'haskell/security-advisories' }}
run: |
mkdir generatedWebsite
docker run --rm -v $PWD:/repo --workdir /repo haskell/hsec-tools:latest /bin/hsec-tools generate-index . generatedWebsite
cp generatedWebsite/by-dates.html generatedWebsite/index.html
rm -Rf generatedWebsite/advisories || echo "Markdown links issue has been fixed"
- name: Deploy
- name: Deploy the website
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && github.repository == 'haskell/security-advisories' }}
with:
Expand Down

0 comments on commit a8fa994

Please sign in to comment.