-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 2.75 KB
/
Copy pathdeploy.yaml
File metadata and controls
104 lines (89 loc) · 2.75 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
101
102
103
104
name: Generate and deploy scverse stats
on:
push:
branches: [main]
workflow_dispatch:
schedule:
# Run Mondays and Thursdays at 06:00 UTC to get fresh stats
- cron: "0 6 * * 1,4"
jobs:
generate-data:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Generate scverse stats
env:
GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }}
ZULIP_EMAIL: ${{ secrets.ZULIP_EMAIL }}
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
ZULIP_REALM: ${{ secrets.ZULIP_REALM }}
PEPY_API_KEY: ${{ secrets.PEPY_API_KEY }}
run: |
npm start
- name: Prepare build directory
run: |
mkdir -p build
touch build/.nojekyll
cp -r output/* build/
- name: Check if stats.json exists and is valid
run: |
if [ ! -s build/stats.json ]; then
echo "Error: stats.json is empty or does not exist"
exit 1
fi
# Validate JSON syntax
jq empty build/stats.json
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: "build"
deploy:
runs-on: ubuntu-latest
needs: generate-data
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Trigger website build
run: |
curl -XPOST \
-u "scverse-bot:${{ secrets.BOT_GH_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/scverse/stats/actions/workflows/gh-pages.yml/dispatches \
--data '{"ref": "main"}'
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
# aws-region: ${{ env.AWS_REGION }}
keepalive-job:
name: Keepalive Workflow
runs-on: ubuntu-slim
permissions:
actions: write
steps:
- name: Re-enable workflow
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN || github.token }}
shell: sh
run: |
gh api --verbose -X PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/deploy.yaml/enable"