-
Notifications
You must be signed in to change notification settings - Fork 13
93 lines (83 loc) · 2.59 KB
/
schema-metadata.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: schema-eas-metadata
on:
pull_request:
types: [opened, synchronize]
paths:
- '.github/actions/**'
- .github/workflows/schema-metadata.yml
- 'scripts/**'
- package.json
workflow_dispatch:
inputs:
version:
description: EAS CLI tag or exact version to use (without `v`)
type: string
default: latest
storage:
description: Update the EAS metadata schema in storage?
type: choice
default: skip
options:
- skip
- update-schema
schedule:
# daily at 07:00h UTC
- cron: 0 7 * * *
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
- name: 🏗 Setup project
uses: ./.github/actions/setup-project
- name: 🌐 Resolve version
id: version
uses: ./.github/actions/package-version
with:
name: eas-cli
semver: ${{ github.event.inputs.version || 'latest' }}
- name: 👷 Download schema
run: |
mkdir -p ./schema
rm -f ./schema/eas-metadata.json
curl https://raw.githubusercontent.com/expo/eas-cli/v${{ steps.version.outputs.exact }}/packages/eas-cli/schema/metadata-0.json -o ./schema/eas-metadata.json
- name: 📋 Upload schema
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: schema-metadata
path: ./schema/eas-metadata.json
publish:
if: ${{ github.event_name == 'schedule' || github.event.inputs.storage == 'update-schema' }}
runs-on: ubuntu-latest
needs: generate
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
with:
ref: schemas
token: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
- name: 📋 Download schema
uses: actions/download-artifact@v4
with:
name: schema-metadata
path: ./schema/
- name: 🕵️ Latest schema
id: diff
run: |
if [ "$(git diff | wc -l)" -gt "0" ]; then
echo "⚠️ Schema has changed, see changes below"
git diff
exit 1
else
echo "✅ Schema is up-to-date"
fi
- name: 🗂 Update schema
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
run: |
git config --global user.name 'Expo CI'
git config --global user.email '[email protected]'
git add ./schema
git commit -am "chore: generate eas metadata schema for $(date +"%Y-%m-%dT%H-%M-%S%z")"
git push