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-20.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: '14.17' 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 - name: Install Expo CLI v3 49 run: yarn global add expo-cli@3 50 51 # - name: Publish Expo app 52 # working-directory: ./apps/native-component-list 53 # run: expo publish --release-channel=pr-${{ github.event.number }} 54 # # Get Expo link for the comment 55 # - name: Get expo link 56 # id: expo 57 # run: echo "::set-output name=path::@community/native-component-list?release-channel=pr-${{ github.event.number }}" 58 # Build the Expo website 59 - name: Build Website 60 working-directory: ./apps/native-component-list 61 run: yarn build:web 62 # Deploy Expo web to now 63 - name: Publish Website 64 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 65 working-directory: ./apps/native-component-list 66 env: 67 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 68 BUILD_ID: ${{ github.sha }} 69 run: npx now deploy web-build --env NODE_ENV=production --confirm --public --no-clipboard --token=${ZEIT_TOKEN} > deploy-url.txt 70 # Save variable 71 - name: Set deploy url to env variable 72 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 73 run: echo "ZEIT_DEPLOY=$(cat deploy-url.txt)" >> $GITHUB_ENV 74 # Alias the now deployment URL 75 - name: Alias with PR number 76 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 77 working-directory: ./apps/native-component-list 78 env: 79 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 80 SITE_ALIAS: expo-web-${{ github.event.number }}.now.sh 81 run: npx now alias --token=${ZEIT_TOKEN} `cat deploy-url.txt` $SITE_ALIAS 82 # Send comment to the thread 83 - name: Add comment with deploy url 84 if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 85 uses: unsplash/comment-on-pr@master 86 env: 87 GITHUB_TOKEN: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} 88 with: 89 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> 90 # 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> 91