Files
cve/.github/workflows/site.yml
T

100 lines
2.6 KiB
YAML

name: Build & Deploy PoC Index
on:
schedule:
- cron: '20 6 * * *'
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Verify code
run: |
python3 -m unittest discover -s tests
node --test tests/test_search.js
- name: Build site data
run: python3 scripts/build_site.py
- name: Check sponsorship availability
timeout-minutes: 1
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
sponsor_enabled=false
if sponsor_public=$(gh api graphql \
-f query='query { user(login: "0xMarcio") { sponsorsListing { isPublic } } }' \
--jq '.data.user.sponsorsListing.isPublic // false'); then
if [ "$sponsor_public" = "true" ]; then
sponsor_enabled=true
fi
fi
echo "POCINDEX_SPONSORS_ENABLED=$sponsor_enabled" >> "$GITHUB_ENV"
- name: Build homepage and CVE pages
run: python3 scripts/build_pages.py
- name: Build robots.txt and sitemaps
run: python3 scripts/build_seo.py
- name: Rasterise the social card
run: |
# og:image has to be a raster: Twitter, Slack and Discord all ignore SVG.
# Drawn here so the PNG lives in the deployed artifact, not in git.
sudo apt-get update -qq >/dev/null
sudo apt-get install -y --no-install-recommends librsvg2-bin >/dev/null
rsvg-convert -w 1280 -h 640 docs/social-card.svg -o docs/social-card.png
- name: Verify published counts
run: |
python3 .github/hero.py
python3 .github/getTrending.py --counts-only
git diff --exit-code -- \
README.md \
docs/hero.svg \
docs/social-card.svg \
docs/stats.json
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v5