forked from roshank231/optest
-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (77 loc) · 2.23 KB
/
update.yaml
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
name: Update One Pace episodes
on:
push:
branches:
- main
schedule:
- cron: 0 * * * *
workflow_dispatch:
jobs:
scrape:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
message: ${{ steps.commit.outputs.pushed && steps.scrape.outputs.message }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout subtitles repo
uses: actions/checkout@v4
with:
repository: one-pace/one-pace-public-subtitles
path: scripts/subtitles
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- name: Setup FFmpeg
uses: federicocarboni/setup-ffmpeg@v3
- name: Install dependencies
run: npm ci
- name: Generate GraphQL types
run: npm run generate
- name: Get current date
id: date
run: |
echo "utc=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT"
- name: Restore torrent files
id: cache
uses: actions/cache/restore@v4
with:
path: cache
key: torrents-${{ steps.date.outputs.utc }}
restore-keys: |
torrents-
- name: Scrape One Pace website
id: scrape
run: |
echo "message<<EOF" >> "$GITHUB_OUTPUT"
npm run --silent scrape | sed 's/$/<br>/g' >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Cache torrent files
uses: actions/cache/save@v4
if: always()
with:
path: cache
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Commit changes
id: commit
uses: EndBug/add-and-commit@v9
with:
message: Update One Pace episodes
default_author: github_actions
notify:
runs-on: ubuntu-latest
needs:
- scrape
if: needs.scrape.outputs.message
steps:
- name: Send message to Matrix
uses: s3krit/matrix-message-action@v0.0.3
with:
server: ${{ vars.MATRIX_SERVER }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
room_id: ${{ vars.MATRIX_ROOM_ID }}
message: ${{ needs.scrape.outputs.message }}