Update #1267
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| # Adjust refresh schedule here. By default, it runs once per day. | |
| # Syntax reference: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule | |
| # Recommended tool: https://crontab.guru/ | |
| - cron: "12 5 * * *" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Download ArxivFeed | |
| env: | |
| GITHUB_PAT: ${{ github.token }} | |
| REPO: "NotCraft/ArxivFeed" | |
| VERSION: "latest" | |
| MATCH: "arxivfeed-.+-x86_64-unknown-linux-musl.tar.gz$" | |
| RENAME: "arxivfeed.tgz" | |
| shell: bash | |
| run: | | |
| curl -sL --fail \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Authorization: Bearer ${GITHUB_PAT}" \ | |
| "https://api.github.com/repos/${REPO}/releases/${VERSION}" \ | |
| | jq -r ".assets | .[] | select(.name | test(\"${MATCH}\")) | .url" \ | |
| | tee asset.url | |
| curl -sL --fail \ | |
| -H "Accept: application/octet-stream" \ | |
| -H "Authorization: Bearer ${GITHUB_PAT}" \ | |
| -o "${RENAME}" \ | |
| "$(cat asset.url)" | |
| tar -zxvf arxivfeed.tgz --strip-components 1 $(tar tf arxivfeed.tgz | grep /arxivfeed) | |
| chmod +x arxivfeed | |
| - name: Build rss | |
| run: | | |
| mkdir -p target | |
| # Try to fetch existing cache from GitHub Pages, fall back to empty | |
| curl -sL "https://darl-libsignal.github.io/SignalArxiv/cache.json" -o target/cache.json 2>/dev/null || echo '{}' > target/cache.json | |
| # Start local HTTP server to serve cache between runs | |
| python3 -m http.server 9999 -d target & | |
| sleep 1 | |
| # arXiv API rate limits to ~1 req/3s. Run ArxivFeed once per category | |
| # with sleep between runs. Each run reads accumulated cache and appends. | |
| CATEGORIES="cs.SY:Systems and Control|cs.LG:Machine Learning|cs.AI:Artificial Intelligence|cs.CE:Computational Engineering" | |
| IFS='|' read -ra ENTRIES <<< "$CATEGORIES" | |
| for entry in "${ENTRIES[@]}"; do | |
| IFS=':' read -r CAT TITLE <<< "$entry" | |
| cat > config.toml << EOF | |
| site_title = "LibSignal-SignalArxiv" | |
| limit_days = 7 | |
| cache_url = "http://localhost:9999/cache.json" | |
| [[sources]] | |
| limit = 150 | |
| category = "$CAT" | |
| title = "$TITLE" | |
| [scripts] | |
| highlight_title = "scripts/highlight_title.rhai" | |
| highlight_author = "scripts/highlight_author.rhai" | |
| highlight_conference = "scripts/highlight_conference.rhai" | |
| EOF | |
| echo "--- Fetching $CAT ---" | |
| ./arxivfeed | |
| sleep 4 | |
| done | |
| # Restore original config | |
| git checkout config.toml | |
| kill %1 2>/dev/null || true | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./target | |
| force_orphan: true |