Repository navigation
100 lines (96 loc) · 3.26 KB
/
Copy pathpages.yml
File metadata and controls
100 lines (96 loc) · 3.26 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Update content and deploy Next.js to Pages
on:
push:
branches: [main]
schedule:
# Brasília is UTC-3: Tuesday 09:17 = Tuesday 12:17 UTC.
- cron: '17 12 * * 2'
workflow_dispatch:
inputs:
refresh_content:
description: 'Update stored content before deploying (Apify runs at most once per source per week)'
type: boolean
default: true
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: web/package-lock.json
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
working-directory: web
run: npm ci
- name: Check source formatting
working-directory: web
run: |
npm run format:check
python -m pip install -r requirements-dev.txt
python -m black --check scripts
- name: Update stored content
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.refresh_content)
working-directory: web
continue-on-error: true
env:
APIFY_TOKEN: ${{ secrets.APIFY_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATTES_DRIVE_URL: ${{ secrets.LATTES_DRIVE_URL }}
run: npm run sync:weekly
- name: Commit only changed content
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.refresh_content)
run: |
git add web/data/publications.json web/data/projects.json web/data/people.json web/data/papers.json web/data/media
if ! git diff --cached --quiet; then
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -m 'Update stored research group content [skip ci]'
# Never force-push: incorporate concurrent changes or fail on a conflict.
git fetch origin main
git rebase origin/main
git push origin HEAD:main
fi
# GITHUB_TOKEN commits do not trigger another push workflow.
- name: Configure Pages
id: pages
uses: actions/configure-pages@v5
- name: Export static site
working-directory: web
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.pages.outputs.base_path }}
run: npm run build
- name: Check exported routes and local assets
working-directory: web
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.pages.outputs.base_path }}
run: node scripts/check-static.mjs
- name: Upload static site
uses: actions/upload-pages-artifact@v3
with:
path: web/out
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4