-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 1.85 KB
/
generate.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
name: assets-generator
on:
schedule:
- cron: "37 */2 * * *" # this is UTC
push:
branches:
- main
paths:
- "src/**"
- "go.mod"
- "go.sum"
workflow_dispatch:
jobs:
assets-generator:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.add-and-commit.outputs.committed }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Connect to Tailnet
uses: tailscale/github-action@v3
with:
args: --accept-dns=true
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:github-runner
version: latest
- name: Run go code
run: |
go run ./src -sleep .
- name: JQ formatting JSON
run: |
# running jq -c . to compact output
jq -c . output.json > docs/data.min.json
# running jq . to easier readable file
jq . output.json > docs/data.json
- name: Generate checksum for data.json
run: |
# generating checksum for all JSON files in folder
find *.json -type f -exec sha256sum {} \; > sha256sum.txt
find *.json -type f -exec sha512sum {} \; > sha512sum.txt
working-directory: docs
- uses: EndBug/add-and-commit@v9
id: add-and-commit
with:
add: "docs"
message: ".github/workflows/generate.yml: workflow generated JSON"
github-pages-deploy:
runs-on: ubuntu-latest
needs: assets-generator
if: needs.assets-generator.outputs.changed == 'true'
steps:
- name: Dispatch GitHub Pages deployment
uses: peter-evans/repository-dispatch@v3
with:
event-type: tibiadata-api-assets-deploy