-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (53 loc) · 1.9 KB
/
pr-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: 'Deploy PR build'
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
permissions: write-all
jobs:
deploy-affected-ci:
# only run if pull request is approved and QA is required
if: contains(github.event.comment.body, 'deploy test')
runs-on: ubuntu-latest
steps:
- name: 'Login to Azure'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
allow-no-subscriptions: true
- name: 'Obtain token for upload'
shell: bash
run: echo "FUSION_TOKEN=$(az account get-access-token --resource '${{ secrets.AZURE_RESOURCE_ID }}' | jq '.accessToken')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to fetch range
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
- name: Install Dependencies
run: npm i -g typescript && pnpm install
- name: Build monorepo
run: pnpm ci:build
- name: 'Deploy affected apps to Fusion CI'
shell: bash
env:
#Runs out of memory when bundling more apps otherwise even though concurrency is 1
NODE_OPTIONS: '--max_old_space_size=4096'
run: npx turbo run pr:deploy --since origin/main --concurrency 1 -- --token ${{ env.FUSION_TOKEN }} --pr ${{ github.event.pull_request.number }}
- name: Comment pr
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Deployed! 🚀'
})