-
Notifications
You must be signed in to change notification settings - Fork 25
112 lines (95 loc) · 3.26 KB
/
update-releases.yml
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
105
106
107
108
109
110
111
112
name: Update Releases
concurrency: update-releases
on:
schedule:
- cron: "*/5 * * * *"
workflow_dispatch:
push:
branches:
- source
paths:
- "mods.json"
pull_request:
branches:
- "source"
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v4
with:
version: 8.6.10
run_install: true
- name: Build
run: |
cd scripts
pnpm run build
- name: Checkout database repo
uses: actions/checkout@v4
with:
ref: master
path: database
- name: Make database copy
run: cp database/database.json previous-database.json
- name: Remove existing thumbnails
run: rm -rf database/thumbnails
- name: Fetch mod releases and manifests
uses: ./actions/update-database
with:
out-directory: database
GITHUB_TOKEN: ${{ env.GH_TOKEN }}
mods: mods.json
previous-database: previous-database.json
google-service-account: ${{ github.event_name != 'pull_request' && secrets.GOOGLE_SERVICE_ACCOUNT || '' }}
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: database
- name: Deploy to GitHub Pages
if: ${{ github.event_name != 'pull_request' }}
uses: actions/deploy-pages@v4
with:
token: ${{ env.GH_TOKEN }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ github.event_name != 'pull_request' }}
with:
branch: master
repository: database
commit_message: Update mod database
commit_user_name: Outer Wilds Mod Database
commit_user_email: database@outerwildsmods.com
commit_author: Outer Wilds Mod Database <database@outerwildsmods.com>
- name: Dispatch Website Build Event
if: ${{ github.event_name != 'pull_request' }}
run: |
curl -XPOST -u "${{ secrets.GH_USER }}:${{ env.GH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/ow-mods/outerwildsmods.com/dispatches --data '{"event_type": "build"}'
- name: Send Notifications
if: ${{ github.event_name != 'pull_request' }}
uses: ./actions/send-notifications
with:
previous-database: previous-database.json
next-database: database/database.json
discord-mod-hook-urls: ${{ secrets.DISCORD_MOD_HOOK_URLS }}
discord-hook-url: ${{ secrets.DISCORD_HOOK_URL }}
discord-mod-update-role-id: ${{ secrets.DISCORD_MOD_UPDATE_ROLE_ID }}
discord-new-mod-role-id: ${{ secrets.DISCORD_NEW_MOD_ROLE_ID }}