-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (68 loc) · 2.65 KB
/
auto-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
72
73
74
75
76
77
78
name: Auto Generate Types
on:
schedule:
- cron: '30 * * * *'
push:
branches: [master]
repository_dispatch:
types: [auto-generate-types]
workflow_dispatch: # for manual testing
jobs:
generate:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
# we used to download `types` branch here, but looks like we don't need that anymore, and can skip linting old types
# generate and lint types
- name: Generate types
id: generate
run: npm start -- --new-revisions-only --cache-discovery-json ${{ runner.temp }}
- name: Lint types
id: lint
run: npm run lint
env:
GAPI_MAX_PARALLEL: 3
- name: debug1
if: always()
run: echo ${{ steps.generate.outputs.FAILED_TYPE }} && echo ${{join(steps.generate.outputs.*, '\n')}}
- name: debug2
if: always()
run: echo ${{ steps.lint.outputs.FAILED_TYPE }} && echo ${{join(steps.lint.outputs.*, '\n')}}
- name: debug3
if: always()
run: echo ${{join(steps.*.outputs.*, '\n')}}
# upload failed type for investigation
- name: Copy discovery service response if failed to generate
if: failure() && steps.generate.outputs.FAILED_TYPE != ''
run: cp ${{ runner.temp }}/${{ steps.generate.outputs.FAILED_TYPE }}.json types/${{ steps.generate.outputs.FAILED_TYPE }}
- name: Copy discovery service response if failed to lint
if: failure() && steps.lint.outputs.FAILED_TYPE != ''
run: cp ${{ runner.temp }}/${{ steps.lint.outputs.FAILED_TYPE }}.json types/${{ steps.lint.outputs.FAILED_TYPE }}
- name: Upload type that failed to generate
uses: actions/upload-artifact@v4
if: failure() && steps.generate.outputs.FAILED_TYPE != ''
with:
name: ${{ steps.generate.outputs.FAILED_TYPE }}
path: types/${{ steps.generate.outputs.FAILED_TYPE }}
- name: Upload type that failed to lint
uses: actions/upload-artifact@v4
if: failure() && steps.lint.outputs.FAILED_TYPE != ''
with:
name: ${{ steps.lint.outputs.FAILED_TYPE }}
path: types/${{ steps.lint.outputs.FAILED_TYPE }}
# upload types on success
- name: Deploy
uses: peaceiris/actions-gh-pages@v4 # cspell:words peaceiris
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: types
publish_dir: ./types
allow_empty_commit: false