update router template #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Expo Preview | |
on: | |
push: | |
branches: [] | |
jobs: | |
changed: | |
name: Find changed apps | |
runs-on: ubuntu-latest | |
outputs: | |
exampleChanged: ${{ steps.filter.outputs.examples }} | |
exampleNames: ${{ steps.find.outputs.result }} | |
steps: | |
- name: 🏗️ Setup repo | |
uses: actions/checkout@v2 | |
- id: filter | |
name: 🕵️ Detect changes | |
uses: dorny/paths-filter@v2 | |
with: | |
list-files: json | |
filters: | | |
examples: | |
- blank/** | |
- with-!(dev-client|yarn-workspaces)/?** | |
- id: find | |
name: 📱 Find changed examples | |
uses: actions/github-script@v5 | |
if: ${{ steps.filter.outputs.examples == 'true' }} | |
with: | |
script: | | |
// Load all changed files to dynamically fetch the app names | |
const path = require('path') | |
const changes = ${{ steps.filter.outputs.examples_files }} | |
// Iterate through all changes and keep unique app names | |
return [...new Set(changes.map(file => path.dirname(file).split('/', 1)[0]))] | |
publish: | |
needs: changed | |
if: ${{ needs.changed.outputs.exampleChanged == 'true' }} | |
name: Publish | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
example: ${{ fromJSON(needs.changed.outputs.exampleNames || '[]') }} | |
defaults: | |
run: | |
working-directory: ${{ matrix.example }} | |
steps: | |
- name: 🏗️ Setup repo | |
uses: actions/checkout@v2 | |
- name: 🏗️ Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
- name: 🏗️ Setup Expo | |
uses: expo/expo-github-action@v6 | |
with: | |
expo-version: 4.x | |
expo-cache: true | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: 📋 Install dependencies | |
run: yarn install --frozen-lockfile --ignore-scripts --check-files | |
- name: ⚙️ Setup manifest | |
run: echo '{"expo":{"owner":"examples"}}' > app.json | |
- name: 🚀 Publish preview | |
run: expo publish |