update readme for wsl2 #4447
Workflow file for this run
This file contains 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: π± FE App Deployment | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: | |
- main | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read # Required to find the last successful workflow run | |
contents: read # Required for actions/checkout | |
steps: | |
- name: π Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Checks out all branches and tags. Maybe we can make this better in the future? | |
# This line is needed for nx affected to work when CI is running on a PR | |
- name: π Track main if PR | |
if: github.ref != 'refs/heads/main' | |
run: git branch --track main origin/main | |
- name: π§ Configure NX SHAs | |
uses: nrwl/nx-set-shas@v4 | |
- name: π§ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.12.2 | |
- run: | | |
corepack enable | |
- name: π§Ά Setup Yarn in Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- name: π¦ Install dependencies | |
run: yarn install | |
- name: 𧩠Determine Affected Projects for eas-update | |
id: set-matrix | |
run: | | |
# Get the list of affected projects with eas-update target | |
affected_projects=$(yarn nx show projects --affected --exclude=shelter --withTarget eas-update) | |
# Convert the list to a JSON matrix | |
MATRIX_JSON=$(echo "$affected_projects" | jq -Rcs ' | |
split("\n") | | |
map(select(. != "")) | | |
if length == 0 then | |
{} | |
else | |
{include: map({project: .})} | |
end' | |
) | |
IS_MATRIX_EMPTY=$(echo "$MATRIX_JSON" | jq 'if .include | length == 0 then true else false end') | |
echo "is_matrix_empty=$IS_MATRIX_EMPTY" >> $GITHUB_OUTPUT | |
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
is_matrix_empty: ${{ steps.set-matrix.outputs.is_matrix_empty }} | |
preview: | |
needs: prepare | |
environment: preview | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
runs-on: ubuntu-latest | |
if: needs.prepare.outputs.is_matrix_empty == 'false' | |
strategy: | |
matrix: ${{fromJson(needs.prepare.outputs.matrix)}} | |
permissions: | |
pull-requests: write # REQUIRED: Allow comments on PRs | |
actions: write # REQUIRED: Allow updating fingerprint in action caches | |
steps: | |
- name: π¦ Turnstyle | |
uses: softprops/turnstyle@master | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
# https://github.com/expo/expo-github-action/issues/229 | |
# Use pull request head commit for PRs, otherwise use default branch ref | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- name: π§ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.12.2 | |
- run: | | |
corepack enable | |
- name: π§Ά Setup Yarn in Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- name: π§ Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: π¦ Install dependencies | |
run: yarn install | |
- name: π Set up Secrets | |
id: setup-secrets | |
uses: ./.github/actions/expo-setup-secrets | |
with: | |
profile: preview | |
project: ${{ matrix.project }} | |
secrets: ${{ toJson(secrets) }} | |
- name: π Preview Build | |
id: preview-build | |
uses: ./.github/actions/expo-build | |
with: | |
profile: preview | |
project: ${{ matrix.project }} | |
runtime-version: ${{ steps.setup-secrets.outputs.runtime-version }} | |
- name: π± Simulator Build | |
id: simulator-build | |
uses: ./.github/actions/expo-build | |
with: | |
profile: development-simulator | |
project: ${{ matrix.project }} | |
platforms: ios | |
runtime-version: ${{ steps.setup-secrets.outputs.runtime-version }} | |
- name: π Perform EAS Update | |
id: expo-update | |
uses: ./.github/actions/expo-update | |
with: | |
project: ${{ matrix.project }} | |
branch: ${{ github.head_ref || github.ref_name }} | |
slug: ${{ steps.preview-build.outputs.slug }} | |
project-id: ${{ steps.preview-build.outputs.project-id }} | |
- name: π Comment on PR | |
if: github.event_name == 'pull_request' | |
uses: edumserrano/find-create-or-update-comment@v3 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body-includes: '<!-- continuous-deploy-fingerprint-projectId:${{ steps.preview-build.outputs.project-id }} -->' | |
comment-author: 'github-actions[bot]' | |
body: | | |
<!-- continuous-deploy-fingerprint-projectId:${{ steps.preview-build.outputs.project-id }} --> | |
π Expo continuous deployment is ready for **${{ matrix.project }}**! | |
- Project β **${{ matrix.project }}** | |
- Environment β **Preview** | |
- Platforms β **android**, **ios** | |
- Scheme β **${{ steps.preview-build.outputs.slug }}** | |
| π€ Android | π iOS | |
--- | --- | --- | |
Runtime Version | `${{ steps.preview-build.outputs.android-runtime-version }}` | `${{ steps.preview-build.outputs.ios-runtime-version }}` | |
Build Details | [Build Permalink](${{ steps.preview-build.outputs.android-build-link }})<br /><details><summary>Details</summary>Distribution: `${{ steps.preview-build.outputs.android-distribution }}`<br />Build profile: `${{ steps.preview-build.outputs.android-build-profile }}`<br />Runtime version: `${{ steps.preview-build.outputs.android-runtime-version }}`<br />App version: `${{ steps.preview-build.outputs.android-app-version }}`<br />Git commit: `${{ steps.preview-build.outputs.android-git-commit }}`</details> | [Build Permalink](${{ steps.preview-build.outputs.ios-build-link }})<br /><details><summary>Details</summary>Distribution: `${{ steps.preview-build.outputs.ios-distribution }}`<br />Build profile: `${{ steps.preview-build.outputs.ios-build-profile }}`<br />Runtime version: `${{ steps.preview-build.outputs.ios-runtime-version }}`<br />App version: `${{ steps.preview-build.outputs.ios-app-version }}`<br />Git commit: `${{ steps.preview-build.outputs.ios-git-commit }}`</details> | |
Update Details | [Update Permalink](${{ steps.expo-update.outputs.android-update-permalink }})<br /><details><summary>Details</summary>Branch: `${{ steps.expo-update.outputs.android-branch }}`<br />Runtime version: `${{ steps.expo-update.outputs.android-runtime-version }}`<br />Git commit: `${{ steps.expo-update.outputs.android-update-commit }}`</details> | [Update Permalink](${{ steps.expo-update.outputs.ios-update-permalink }})<br /><details><summary>Details</summary>Branch: `${{ steps.expo-update.outputs.ios-branch }}`<br />Runtime version: `${{ steps.expo-update.outputs.ios-runtime-version }}`<br />Git commit: `${{ steps.expo-update.outputs.ios-update-commit }}`</details> | |
Update QR | <a href="${{ steps.expo-update.outputs.android-update-qr-url }}"><img src="${{ steps.expo-update.outputs.android-update-qr-url }}" width="250px" height="250px" /></a> | <a href="${{ steps.expo-update.outputs.ios-update-qr-url }}"><img src="${{ steps.expo-update.outputs.ios-update-qr-url }}" width="250px" height="250px" /></a> | |
**iOS Simulator Build:** [Simulator Build Link](${{ steps.simulator-build.outputs.ios-build-link }}) | |
edit-mode: replace | |
- name: π Set Git Variables | |
id: set-git-vars | |
run: | | |
COMMIT_ID=$(git rev-parse HEAD) | |
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s" HEAD) | |
{ | |
echo "commit-id=${COMMIT_ID}" | |
echo "commit-message=${COMMIT_MESSAGE}" | |
} >> $GITHUB_OUTPUT | |
- name: π£ Post to Slack | |
if: ${{ env.BRANCH_NAME == 'main' }} | |
uses: slackapi/slack-github-action@v1.27.0 | |
with: | |
payload: | | |
{ | |
"channel": "#tech-outreach-main", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*New code has landed in main for project ${{ matrix.project }}!* \n*Commit:* `${{ steps.set-git-vars.outputs.commit-id }}`\n*Message:* ${{ steps.set-git-vars.outputs.commit-message }}" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*π± iOS*\n\n<${{ steps.expo-update.outputs.ios-update-qr-url }}|Update>\n<${{ steps.preview-build.outputs.ios-build-link }}|Build>\n<${{ steps.simulator-build.outputs.ios-build-link }}|Simulator Build>" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*π€ Android*\n\n<${{ steps.expo-update.outputs.android-update-qr-url }}|Update>\n<${{ steps.preview-build.outputs.android-build-link }}|Build>" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: π§Ό Cleanup .env file | |
if: always() | |
run: | | |
rm -f .env | |
working-directory: apps/${{ matrix.project }} | |
production: | |
if: github.ref == 'refs/heads/main' && needs.prepare.outputs.is_matrix_empty == 'false' | |
needs: prepare | |
environment: production | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
permissions: | |
pull-requests: write # REQUIRED: Allow comments on PRs | |
actions: write # REQUIRED: Allow updating fingerprint in action caches | |
steps: | |
- name: π¦ Turnstyle | |
uses: softprops/turnstyle@master | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: π§ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.12.2 | |
- run: | | |
corepack enable | |
- name: π§Ά Setup Yarn in Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- name: π§ Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: π¦ Install dependencies | |
run: yarn install | |
- name: π Set up Secrets | |
id: setup-secrets | |
uses: ./.github/actions/expo-setup-secrets | |
with: | |
profile: production | |
project: ${{ matrix.project }} | |
secrets: ${{ toJson(secrets) }} | |
- name: π Production Build | |
uses: ./.github/actions/expo-build | |
with: | |
profile: production | |
project: ${{ matrix.project }} | |
runtime-version: ${{ steps.setup-secrets.outputs.runtime-version }} | |
- name: π Perform EAS Update | |
id: expo-update | |
uses: ./.github/actions/expo-update | |
with: | |
project: ${{ matrix.project }} | |
branch: main | |
slug: ${{ steps.preview-build.outputs.slug }} | |
project-id: ${{ steps.preview-build.outputs.project-id }} | |
- name: π§Ό Cleanup .env file | |
if: always() | |
run: | | |
rm -f .env | |
working-directory: apps/${{ matrix.project }} |