Skip to content

Commit

Permalink
chore: add CI workflow for EAS Workflow schema
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Feb 10, 2025
1 parent d7f37ac commit 53a7388
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/schema-eas-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: schema-eas-workflow

on:
pull_request:
types: [opened, synchronize]
paths:
- '.github/actions/**'
- .github/workflows/schema-eas-workflow.yml
- 'scripts/**'
- package.json
workflow_dispatch:
inputs:
storage:
description: Update the EAS Workflow 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: 👷 Generate latest schema
if: ${{ github.event_name == 'schedule' }}
run: node ./scripts/schema-eas-workflow.js

- name: 📋 Upload schema
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: schema-eas-workflow
path: ./schema/eas-workflow.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-eas-workflow
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 workflow schema for $(date +"%Y-%m-%dT%H-%M-%S%z")"
git push

0 comments on commit 53a7388

Please sign in to comment.