-
-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (60 loc) · 2.02 KB
/
cron.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
name: Cron
on:
workflow_dispatch:
schedule:
- cron: '0 22 * * *' # Every night at 22:00 UTC+0
env:
FORCE_COLOR: true
jobs:
update:
name: Daily Update
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v4
- name: Configure GPG Key
run: echo -n "$GPG_KEY" | gpg --import
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
- name: Get seasonal data from Kitsu.io
run: yarn cron
env:
KITSU_USERNAME: ${{ secrets.KITSU_USERNAME }}
KITSU_PASSWORD: ${{ secrets.KITSU_PASSWORD }}
- name: Get today's date
id: date
run: echo "::set-output name=today::$(date +%F)"
- name: Commit updated seasonal data
run: |
git config --global user.name '${{ secrets.GH_USERNAME }}'
git config --global user.email '${{ secrets.GH_EMAIL }}'
git config --global user.signingkey ${{ secrets.GPG_SIGNING_KEY }}
git config --global commit.gpgsign true
git add data/
git commit -am 'chore: add data for ${{ steps.date.outputs.today }}'
git push
- name: Trigger CI Workflow
if: success()
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: ${{ github.repository }}
event-type: trigger-ci-workflow
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'