-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.45 KB
/
Copy pathsync-and-deploy.yml
File metadata and controls
88 lines (74 loc) · 2.45 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
name: Sync Telemetry & Deploy to GitHub Pages
on:
schedule:
# Run every Monday at 04:00 UTC
- cron: '0 4 * * 1'
push:
branches:
- main
workflow_dispatch:
inputs:
sync:
description: 'Fetch live telemetry for all projects'
required: false
type: boolean
default: false
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages and git commits
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
sync-build-deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate catalog schema
run: pnpm run validate
- name: Fetch live GitHub telemetry
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.sync == true)
run: pnpm run sync
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit updated telemetry snapshot (if changed)
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.sync == true)
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet data/projects-enriched.json public/data/projects-enriched.json; then
git add data/projects-enriched.json public/data/projects-enriched.json
git commit -m "chore(data): auto-update telemetry snapshot [skip ci]"
git push
else
echo "No telemetry changes detected."
fi
- name: Build React showcase website
run: pnpm run build
- name: Setup GitHub Pages
uses: actions/configure-pages@v5
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4