forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (78 loc) · 3.33 KB
/
preDeploy.yml
File metadata and controls
94 lines (78 loc) · 3.33 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Reminder: If this workflow's name changes, update the name in the dependent workflow at .github/workflows/failureNotifier.yml.
name: Process new code merged to main
on:
push:
branches: [main]
paths-ignore: [docs/**, help/**, contributingGuides/**, jest/**, tests/**]
jobs:
typecheck:
uses: ./.github/workflows/typecheck.yml
lint:
uses: ./.github/workflows/lint.yml
prettier:
uses: ./.github/workflows/prettier.yml
test:
uses: ./.github/workflows/test.yml
secrets: inherit
confirmPassingBuild:
runs-on: blacksmith-4vcpu-ubuntu-2404
needs: [typecheck, lint, test]
if: ${{ always() }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Exit failed workflow
if: ${{ needs.typecheck.result == 'failure' || needs.lint.result == 'failure' || needs.test.result == 'failure' }}
run: |
echo "Checks failed, exiting ~ typecheck: ${{ needs.typecheck.result }}, lint: ${{ needs.lint.result }}, test: ${{ needs.test.result }}"
exit 1
chooseDeployActions:
runs-on: blacksmith-4vcpu-ubuntu-2404
needs: confirmPassingBuild
outputs:
MERGED_PR: ${{ steps.getMergedPullRequest.outputs.number }}
SHOULD_DEPLOY: ${{ fromJSON(steps.shouldDeploy.outputs.SHOULD_DEPLOY) }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Get merged pull request
id: getMergedPullRequest
uses: actions-ecosystem/action-get-merged-pull-request@59afe90821bb0b555082ce8ff1e36b03f91553d9
with:
github_token: ${{ github.token }}
- name: Check if StagingDeployCash is locked
id: isStagingDeployLocked
uses: ./.github/actions/javascript/isStagingDeployLocked
with:
GITHUB_TOKEN: ${{ github.token }}
- name: Check if merged pull request should trigger a deploy
id: shouldDeploy
run: |
if gh api /orgs/Expensify/teams/mobile-deployers/memberships/${{ github.actor }} --silent; then
echo "SHOULD_DEPLOY=${{ (!fromJSON(steps.isStagingDeployLocked.outputs.IS_LOCKED) && github.actor != 'OSBotify') }}" >> "$GITHUB_OUTPUT"
else
echo "SHOULD_DEPLOY=false" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
skipDeploy:
runs-on: blacksmith-4vcpu-ubuntu-2404
needs: chooseDeployActions
if: ${{ !fromJSON(needs.chooseDeployActions.outputs.SHOULD_DEPLOY) && github.actor != 'OSBotify' }}
steps:
- name: Comment on deferred PR
uses: actions-ecosystem/action-create-comment@cd098164398331c50e7dfdd0dfa1b564a1873fac
with:
github_token: ${{ secrets.OS_BOTIFY_TOKEN }}
number: ${{ needs.chooseDeployActions.outputs.MERGED_PR }}
body: |
:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.
createNewVersion:
needs: chooseDeployActions
if: ${{ fromJSON(needs.chooseDeployActions.outputs.SHOULD_DEPLOY) }}
uses: ./.github/workflows/createNewVersion.yml
secrets: inherit
updateStaging:
needs: [chooseDeployActions, createNewVersion]
uses: ./.github/workflows/updateProtectedBranch.yml
secrets: inherit
with:
TARGET_BRANCH: staging