1name: Publish Expo Web 2on: 3 workflow_dispatch: {} 4 # pull_request: 5 # paths: 6 # - .github/workflows/web.yml 7 # - yarn.lock 8 # - apps/** 9 # - packages/** 10 11concurrency: 12 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 13 cancel-in-progress: true 14 15jobs: 16 build: 17 runs-on: ubuntu-22.04 18 steps: 19 - name: Checkout 20 uses: actions/checkout@v3 21 with: 22 submodules: true 23 - name: ⬢ Setup Node 24 uses: actions/setup-node@v3 25 with: 26 node-version: 16 27 - name: ♻️ Restore caches 28 uses: ./.github/actions/expo-caches 29 id: expo-caches 30 with: 31 yarn-workspace: 'true' 32 git-lfs: 'true' 33 - name: Pull Git LFS files 34 run: git lfs pull 35 36 # Setup Expo CLI action 37 # - name: Setup Expo 38 # uses: expo/expo-github-action@v5 39 # with: 40 # expo-version: 3.x 41 # expo-username: ${{ secrets.EXPO_CLI_USERNAME }} 42 # expo-password: ${{ secrets.EXPO_CLI_PASSWORD }} 43 # expo-cache: true 44 45 - name: Install workspace node modules 46 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 47 run: yarn install --frozen-lockfile 48 49 # - name: Publish Expo app 50 # working-directory: ./apps/native-component-list 51 # run: expo publish --release-channel=pr-${{ github.event.number }} 52 # # Get Expo link for the comment 53 # - name: Get expo link 54 # id: expo 55 # run: echo "path=@community/native-component-list?release-channel=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT 56 # Build the Expo website 57 - name: Build Website 58 working-directory: ./apps/native-component-list 59 run: yarn build:web 60 # Deploy Expo web to now 61 - name: Publish Website 62 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 63 working-directory: ./apps/native-component-list 64 env: 65 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 66 BUILD_ID: ${{ github.sha }} 67 run: npx now deploy web-build --env NODE_ENV=production --confirm --public --no-clipboard --token=${ZEIT_TOKEN} > deploy-url.txt 68 # Save variable 69 - name: Set deploy url to env variable 70 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 71 run: echo "ZEIT_DEPLOY=$(cat deploy-url.txt)" >> $GITHUB_ENV 72 # Alias the now deployment URL 73 - name: Alias with PR number 74 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 75 working-directory: ./apps/native-component-list 76 env: 77 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 78 SITE_ALIAS: expo-web-${{ github.event.number }}.now.sh 79 run: npx now alias --token=${ZEIT_TOKEN} `cat deploy-url.txt` $SITE_ALIAS 80 # Send comment to the thread 81 - name: Add comment with deploy url 82 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 83 uses: unsplash/comment-on-pr@master 84 env: 85 GITHUB_TOKEN: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 86 with: 87 msg: Native Component List for this branch is ready<br><a aria-label="Try the web preview of this PR" href="https://expo-web-${{ github.event.number }}.now.sh/"><img longdesc="Try the web preview of this PR" src="https://img.shields.io/badge/Web-Run_Now-4630EB.svg?style=for-the-badge&logo=GOOGLE-CHROME&labelColor=000&logoColor=fff" target="_blank" /></a> 88 # msg: Native Component List for this branch is ready<br><a aria-label="Try the web preview of this PR" href="https://expo-web-${{ github.event.number }}.now.sh/"><img longdesc="Try the web preview of this PR" src="https://img.shields.io/badge/Web-Run_Now-4630EB.svg?style=for-the-badge&logo=GOOGLE-CHROME&labelColor=000&logoColor=fff" target="_blank" /></a><br><a aria-label="Try the native preview of this PR" href="https://expo.dev/${{ steps.expo.outputs.path }}"><img longdesc="Try the native preview of this PR" src="https://img.shields.io/badge/Native-Run_Now-4630EB.svg?style=for-the-badge&logo=EXPO&labelColor=000&logoColor=fff" target="_blank" /></a><br><br><a href="https://exp.host/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a> 89