-
Notifications
You must be signed in to change notification settings - Fork 50
65 lines (57 loc) · 2.26 KB
/
update-api.yaml
File metadata and controls
65 lines (57 loc) · 2.26 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
on:
schedule:
- cron: '0 12 * * *'
- cron: '0 15 * * *'
- cron: '0 18 * * *'
- cron: '0 22 * * *'
# manual
workflow_dispatch:
jobs:
notify_discord_start:
runs-on: ubuntu-latest
steps:
- uses: tsickert/discord-webhook@v5.3.0
with:
webhook-url: ${{ secrets.DEPLOY_DISCORD_WEBHOOK }}
username: "Update Api 🤖"
content: "Starting API update process..."
api:
runs-on: ubuntu-latest
outputs:
uploaded_count: ${{ steps.build.outputs.uploaded_count }}
uploaded_versions: ${{ steps.build.outputs.uploaded_versions }}
versions_checked: ${{ steps.build.outputs.versions_checked }}
duration: ${{ steps.build.outputs.duration }}
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
# choose node.js version to use
node-version: '20'
# install dependencies if the cache did not hit
- name: Install dependencies
run: npm install
- name: Update needle engine api
id: build
run: npm run docs:build-api
env:
API_FTP_USER: ${{ secrets.API_FTP_USER }}
API_FTP_PASSWORD: ${{ secrets.API_FTP_PASSWORD }}
API_FTP_HOST: ${{ secrets.API_FTP_HOST }}
notify_discord:
needs: api
runs-on: ubuntu-latest
steps:
- uses: tsickert/discord-webhook@v5.3.0
if: ${{ needs.api.outputs.uploaded_count != '0' }}
with:
webhook-url: ${{ secrets.DEPLOY_DISCORD_WEBHOOK }}
username: "Update Api 🤖"
content: "API updated: uploaded ${{ needs.api.outputs.uploaded_count }} new version(s) (${{ needs.api.outputs.uploaded_versions }}) — checked ${{ needs.api.outputs.versions_checked }} versions in ${{ needs.api.outputs.duration }} min → https://engine.needle.tools/docs/api"
- uses: tsickert/discord-webhook@v5.3.0
if: ${{ needs.api.outputs.uploaded_count == '0' }}
with:
webhook-url: ${{ secrets.DEPLOY_DISCORD_WEBHOOK }}
username: "Update Api 🤖"
content: "API is up to date — checked ${{ needs.api.outputs.versions_checked }} versions in ${{ needs.api.outputs.duration }} min → https://engine.needle.tools/docs/api"