Expo Latest #1330
This file contains hidden or 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 Latest | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight UTC | |
| jobs: | |
| check-automation: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-skip: ${{ steps.check-automation.outputs.should-skip }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if triggered by automation | |
| id: check-automation | |
| run: | | |
| # Skip automation check for scheduled runs | |
| if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
| echo "should-skip=false" >> $GITHUB_OUTPUT | |
| echo "✅ Scheduled run - workflow will proceed" | |
| exit 0 | |
| fi | |
| # Skip if actor is github-actions or dependabot | |
| if [[ "${{ github.actor }}" == "github-actions[bot]" ]] || [[ "${{ github.actor }}" == "dependabot[bot]" ]] || [[ "${{ github.actor }}" == "github-actions" ]]; then | |
| echo "should-skip=true" >> $GITHUB_OUTPUT | |
| echo "🚫 Skipping workflow: triggered by automated actor (${{ github.actor }})" | |
| exit 0 | |
| fi | |
| # Get the latest commit message and author | |
| COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
| COMMIT_AUTHOR=$(git log -1 --pretty=%an) | |
| echo "Commit message: $COMMIT_MESSAGE" | |
| echo "Commit author: $COMMIT_AUTHOR" | |
| # Skip if commit message contains [skip ci] or [ci skip] | |
| if echo "$COMMIT_MESSAGE" | grep -q "\[skip ci\]"; then | |
| echo "should-skip=true" >> $GITHUB_OUTPUT | |
| echo "🚫 Skipping workflow: [skip ci] found in commit message" | |
| exit 0 | |
| fi | |
| if echo "$COMMIT_MESSAGE" | grep -q "\[ci skip\]"; then | |
| echo "should-skip=true" >> $GITHUB_OUTPUT | |
| echo "🚫 Skipping workflow: [ci skip] found in commit message" | |
| exit 0 | |
| fi | |
| # Skip if commit author is automated | |
| if [[ "$COMMIT_AUTHOR" == *"github-actions"* ]] || [[ "$COMMIT_AUTHOR" == *"GitHub Action"* ]] || [[ "$COMMIT_AUTHOR" == *"dependabot"* ]]; then | |
| echo "should-skip=true" >> $GITHUB_OUTPUT | |
| echo "🚫 Skipping workflow: commit by automated author ($COMMIT_AUTHOR)" | |
| exit 0 | |
| fi | |
| echo "should-skip=false" >> $GITHUB_OUTPUT | |
| echo "✅ Workflow will proceed" | |
| check-expo-version: | |
| needs: check-automation | |
| if: needs.check-automation.outputs.should-skip != 'true' | |
| runs-on: macos-latest | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| latest_version: ${{ steps.check.outputs.latest_version }} | |
| steps: | |
| - id: check | |
| run: | | |
| LATEST=$(npm view expo version) | |
| CURRENT=$(cat .expo-version 2>/dev/null || echo "") | |
| if [ "$LATEST" != "$CURRENT" ]; then | |
| echo "should_run=true" >> $GITHUB_OUTPUT | |
| echo "latest_version=$LATEST" >> $GITHUB_OUTPUT | |
| echo $LATEST > .expo-version | |
| else | |
| echo "should_run=false" >> $GITHUB_OUTPUT | |
| fi | |
| test-expo-latest: | |
| needs: [check-automation, check-expo-version] | |
| if: ${{ needs.check-automation.outputs.should-skip != 'true' && (needs.check-expo-version.outputs.should_run == 'true' || github.event_name == 'push' || github.event_name == 'pull_request') }} | |
| runs-on: macos-latest | |
| name: Expo latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Create Expo project | |
| run: | | |
| npx create-expo-app@latest test-app --template blank-typescript --yes | |
| cd test-app | |
| - name: Install dependencies | |
| working-directory: test-app | |
| run: | | |
| npm install react-native-web react-dom @expo/metro-runtime --legacy-peer-deps | |
| npm install -D babel-preset-expo --legacy-peer-deps | |
| - name: Install gluestack-ui | |
| working-directory: test-app | |
| run: | | |
| npx gluestack-ui init --template-only --projectType expo --nativewind-v5 -y | |
| npx gluestack-ui add --all -y | |
| - name: Add Button component | |
| working-directory: test-app | |
| run: | | |
| cat <<EOT > App.tsx | |
| import React from 'react'; | |
| import { View } from 'react-native'; | |
| import { Button, ButtonText } from '@/components/ui/button'; | |
| import { GluestackUIProvider } from '@/components/ui/gluestack-ui-provider'; | |
| import "./global.css"; | |
| export default function App() { | |
| return ( | |
| <GluestackUIProvider> | |
| <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> | |
| <Button size="md" variant="solid" action="primary"> | |
| <ButtonText>Hello World!</ButtonText> | |
| </Button> | |
| </View> | |
| </GluestackUIProvider> | |
| ); | |
| } | |
| EOT | |
| - name: Start Expo web app | |
| working-directory: test-app | |
| run: | | |
| npm run web & sleep 30 | |
| - name: Check if button is rendered | |
| run: | | |
| echo "Waiting for dev server..." | |
| sleep 15 | |
| echo "Fetching web bundle from Metro..." | |
| curl -s "http://localhost:8081/index.bundle?platform=web&dev=true" > bundle.js | |
| echo "Searching for 'Hello World!' in the compiled bundle:" | |
| if grep -q "Hello World!" bundle.js; then | |
| echo "Button found and bundle compiled successfully!" | |
| exit 0 | |
| else | |
| echo "Button not found or compilation failed. Bundle output:" | |
| cat bundle.js | head -n 100 | |
| exit 1 | |
| fi |