-
Notifications
You must be signed in to change notification settings - Fork 16
93 lines (88 loc) · 2.89 KB
/
generatePolyfill.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
name: Generate Polyfill
on:
push:
paths:
- .github/workflows/generatePolyfill.yaml
- scripts/generatePolyfill/config.yaml
- scripts/generatePolyfill/index.js
merge_group:
pull_request:
paths:
- .github/workflows/generatePolyfill.yaml
- scripts/generatePolyfill/config.yaml
- scripts/generatePolyfill/index.js
workflow_dispatch:
schedule:
- cron: 0 23 * * 0 # Every 07:00 CST Mon
concurrency:
group: ${{ github.workflow_ref }}-${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
actions: write
checks: read
contents: write
deployments: read
issues: write
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: write
statuses: write
jobs:
generatePolyfill:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout main repo
with:
fetch-depth: 0
show-progress: false
- name: Get the polyfill config
id: polyfillConfig
run: |
echo "TARGET_POLYFILL_VERSION=$(yq '.TARGET_POLYFILL_VERSION' scripts/generatePolyfill/config.yaml)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- uses: actions/checkout@v4
name: Checkout polyfill.io
with:
show-progress: false
repository: JakeChampion/polyfill-service
path: polyfill-service
sparse-checkout: |
polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}/
polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}.json
sparse-checkout-cone-mode: false
- name: Move polyfill.io
id: polyfill
run: |
POLYFILL_PATH="${{ runner.temp }}/$(uuidgen)"
echo "POLYFILL_PATH=$POLYFILL_PATH" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
mkdir -pv $POLYFILL_PATH
mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}.json $POLYFILL_PATH/main.json
mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}/ $POLYFILL_PATH/library
rm -rf polyfill-service
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@v2
with:
command: npm run ci
- name: Git config
run: node scripts/postCommit/prepareGit.js
- name: Gadget-polyfill generator
run: node scripts/generatePolyfill/index.js
env:
POLYFILL_PATH: ${{ steps.polyfill.outputs.POLYFILL_PATH }}
- name: Show git status & push
id: output
run: node scripts/postCommit/push.js
env:
DISPATCH_POST_COMMIT_WORKFLOW: true