summaryrefslogtreecommitdiff
path: root/.github/workflows/update-and-deploy.yml
blob: fb034a6f56c24892cf3fd7b95377c74460e0483a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: grab-data-build-deploy

on:
  schedule:
    - cron: "0 6 * * *"
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 18
      - run: npm ci
      - name: Scrape UIUC catalog
        env:
          NODE_OPTIONS: --dns-result-order=ipv4first
        run: npm run scrape
      - name: Commit data
        run: |
          git config user.name "gh-bot"
          git config user.email "bot@users.noreply.github.com"
          git add data || true
          git diff --cached --quiet || git commit -m "auto: update catalog"
      - run: git push
      - run: npm run build
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist