Skip to content

tests: say what the state/ canary does not catch (#13) #138

tests: say what the state/ canary does not catch (#13)

tests: say what the state/ canary does not catch (#13) #138

Workflow file for this run

name: Deploy store to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
- name: Run engine tests
run: npm test
- name: Build storefront
run: node scripts/build.js
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: dist
- id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
# Search-engine ping. Host and key location come from store.config.json
# and static/, never from a hardcoded name: this file ships in a public
# repo people fork, and a fork must ping for its own site or not at all.
# No key file in static/ means the store never enrolled, so skip.
- name: Ping IndexNow
run: |
KEYFILE=$(ls static 2>/dev/null | grep -m1 '\.txt$' || true)
if [ -z "$KEYFILE" ]; then
echo "indexnow: no key file in static/, skipping"
exit 0
fi
SITE=$(node -p "require('./store.config.json').url.replace(/\/+$/, '')")
HOST=$(node -p "new URL(require('./store.config.json').url).host")
KEY="${KEYFILE%.txt}"
URLS=$(grep -o '<loc>[^<]*</loc>' dist/sitemap.xml | sed 's/<[^>]*>//g' | python3 -c "import sys,json; print(json.dumps([u.strip() for u in sys.stdin if u.strip()]))")
curl -s -X POST "https://api.indexnow.org/indexnow" \
-H "Content-Type: application/json; charset=utf-8" \
-d "{\"host\":\"$HOST\",\"key\":\"$KEY\",\"keyLocation\":\"$SITE/$KEYFILE\",\"urlList\":$URLS}" \
-o /dev/null -w "indexnow: HTTP %{http_code}\n" || true