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 11jobs: 12 build: 13 runs-on: ubuntu-latest 14 steps: 15 - uses: actions/checkout@v2 16 with: 17 submodules: true 18 - name: Get cache key of git lfs files 19 id: git-lfs 20 run: echo "::set-output name=sha256::$(git lfs ls-files | openssl dgst -sha256)" 21 - uses: actions/cache@v2 22 with: 23 path: .git/lfs 24 key: ${{ steps.git-lfs.outputs.sha256 }} 25 - run: git lfs pull 26 - uses: actions/setup-node@v1 27 with: 28 node-version: '14.4.0' 29 - run: yarn global add expo-cli@3 30 - name: Cache Node.js modules 31 uses: actions/cache@v2 32 with: 33 path: ${{ github.workspace }}/node_modules 34 key: ${{ runner.OS }}-node_modules-${{ hashFiles('yarn.lock') }} 35 # Setup Expo CLI action 36 # - name: Setup Expo 37 # uses: expo/expo-github-action@v5 38 # with: 39 # expo-version: 3.x 40 # expo-username: ${{ secrets.EXPO_CLI_USERNAME }} 41 # expo-password: ${{ secrets.EXPO_CLI_PASSWORD }} 42 # expo-cache: true 43 44 - run: yarn --frozen-lockfile 45 46 # - name: Publish Expo app 47 # working-directory: ./apps/native-component-list 48 # run: expo publish --release-channel=pr-${{ github.event.number }} 49 # # Get Expo link for the comment 50 # - name: Get expo link 51 # id: expo 52 # run: echo "::set-output name=path::@community/native-component-list?release-channel=pr-${{ github.event.number }}" 53 # Build the Expo website 54 - name: Build Website 55 working-directory: ./apps/native-component-list 56 run: yarn build:web 57 # Deploy Expo web to now 58 - name: Publish Website 59 if: ${{ github.token }} 60 working-directory: ./apps/native-component-list 61 env: 62 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 63 BUILD_ID: ${{ github.sha }} 64 run: npx now deploy web-build --env NODE_ENV=production --confirm --public --no-clipboard --token=${ZEIT_TOKEN} > deploy-url.txt 65 # Save variable 66 - name: Set deploy url to env variable 67 if: ${{ github.token }} 68 run: echo "ZEIT_DEPLOY=$(cat deploy-url.txt)" >> $GITHUB_ENV 69 # Alias the now deployment URL 70 - name: Alias with PR number 71 if: ${{ github.token }} 72 working-directory: ./apps/native-component-list 73 env: 74 ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }} 75 SITE_ALIAS: expo-web-${{ github.event.number }}.now.sh 76 run: npx now alias --token=${ZEIT_TOKEN} `cat deploy-url.txt` $SITE_ALIAS 77 # Send comment to the thread 78 - name: Add comment with deploy url 79 if: ${{ github.token }} 80 uses: unsplash/comment-on-pr@master 81 env: 82 GITHUB_TOKEN: ${{ github.token }} 83 with: 84 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> 85 # 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.io/${{ 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> 86