name: Publish Expo Web
on:
workflow_dispatch: {}
# pull_request:
# paths:
# - .github/workflows/web.yml
# - yarn.lock
# - apps/**
# - packages/**
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: 👀 Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: ⬢ Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: ♻️ Restore caches
uses: ./.github/actions/expo-caches
id: expo-caches
with:
yarn-workspace: 'true'
git-lfs: 'true'
- name: 🚚 Pull Git LFS files
run: git lfs pull
# Setup Expo CLI action
# - name: Setup Expo
# uses: expo/expo-github-action@v5
# with:
# expo-version: 3.x
# expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
# expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
# expo-cache: true
- name: 🧶 Install workspace node modules
if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
run: yarn install --frozen-lockfile
# - name: Publish Expo app
# working-directory: ./apps/native-component-list
# run: expo publish --release-channel=pr-${{ github.event.number }}
# # Get Expo link for the comment
# - name: Get expo link
# id: expo
# run: echo "path=@community/native-component-list?release-channel=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
# Build the Expo website
- name: Build Website
working-directory: ./apps/native-component-list
run: yarn build:web
# Deploy Expo web to now
- name: Publish Website
if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
working-directory: ./apps/native-component-list
env:
ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
BUILD_ID: ${{ github.sha }}
run: npx now deploy web-build --env NODE_ENV=production --confirm --public --no-clipboard --token=${ZEIT_TOKEN} > deploy-url.txt
# Save variable
- name: Set deploy url to env variable
if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
run: echo "ZEIT_DEPLOY=$(cat deploy-url.txt)" >> $GITHUB_ENV
# Alias the now deployment URL
- name: Alias with PR number
if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
working-directory: ./apps/native-component-list
env:
ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
SITE_ALIAS: expo-web-${{ github.event.number }}.now.sh
run: npx now alias --token=${ZEIT_TOKEN} `cat deploy-url.txt` $SITE_ALIAS
# Send comment to the thread
- name: Add comment with deploy url
if: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }}
with:
msg: Native Component List for this branch is ready
# msg: Native Component List for this branch is ready

