-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (119 loc) · 4.59 KB
/
ci.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Call reusable workflow - Widgets
on:
release:
types: [created]
pull_request:
branches:
- main
workflow_dispatch:
jobs:
prejob:
name: Get Latest Tag
runs-on: ubuntu-latest
outputs:
releaseTag: ${{ steps.tag.outputs.tag }}
releaseName: ${{ steps.name.outputs.name }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: tag
- run: echo "name=$(git describe --tags)" >> $GITHUB_OUTPUT
id: name
call-reusable-workflow-staging:
uses: ./.github/workflows/ci_reusable.yaml
if: github.event_name == 'release' && github.event.action == 'created'
needs: prejob
with:
ENV_NAME: "staging"
REACT_APP_ENV_NAME: "staging"
DEPLOY_TO_FLEEK: true
REACT_APP_RELEASE_TAG: ${{ needs.prejob.outputs.releaseTag }}
REACT_APP_RELEASE_NAME: ${{ needs.prejob.outputs.releaseName }}
REACT_APP_META_TX_API_KEY_MAP: ${{ vars.REACT_APP_META_TX_API_KEY_MAP }}
REACT_APP_META_TX_API_IDS_MAP: ${{ vars.REACT_APP_META_TX_API_IDS_MAP }}
secrets:
FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }}
REACT_APP_INFURA_IPFS_PROJECT_ID: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_ID }}
REACT_APP_INFURA_IPFS_PROJECT_SECRET: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_SECRET }}
REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_STAGING }}
REACT_APP_MAGIC_API_KEY: ${{ secrets.REACT_APP_MAGIC_API_KEY_STAGING }}
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY_STAGING }}
call-reusable-workflow-production:
uses: ./.github/workflows/ci_reusable.yaml
if: github.event_name == 'workflow_dispatch'
needs: prejob
with:
ENV_NAME: "production"
REACT_APP_ENV_NAME: "production"
DEPLOY_TO_FLEEK: true
REACT_APP_RELEASE_TAG: ${{ needs.prejob.outputs.releaseTag }}
REACT_APP_RELEASE_NAME: ${{ needs.prejob.outputs.releaseName }}
REACT_APP_META_TX_API_KEY_MAP: ${{ vars.REACT_APP_META_TX_API_KEY_MAP }}
REACT_APP_META_TX_API_IDS_MAP: ${{ vars.REACT_APP_META_TX_API_IDS_MAP }}
secrets:
FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }}
REACT_APP_INFURA_IPFS_PROJECT_ID: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_ID }}
REACT_APP_INFURA_IPFS_PROJECT_SECRET: ${{ secrets.REACT_APP_INFURA_IPFS_PROJECT_SECRET }}
REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID_PRODUCTION }}
REACT_APP_MAGIC_API_KEY: ${{ secrets.REACT_APP_MAGIC_API_KEY_PRODUCTION }}
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY_PRODUCTION }}
job-summary:
name: Create Job Summary
runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
needs:
[
call-reusable-workflow-staging,
call-reusable-workflow-production
]
steps:
- uses: actions/checkout@v3
- name: Install JQ
uses: r26d/jq-action@master
with:
cmd: jq -n env
- name: Get job outputs
env:
OUTPUTS: ${{ toJSON(needs) }}
run: |
succeededJobOutput="$(
echo '${{ env.OUTPUTS }}' | jq '.[] | select(.result | startswith("success")) | .outputs'
)"
echo 'JOB_OUTPUT='$succeededJobOutput >> $GITHUB_ENV
- name: Get job vars
run: |
jobLint="$(
echo '${{ env.JOB_OUTPUT }}' |
jq '.JOB_LINT'
)"
echo 'JOB_LINT='$jobLint >> $GITHUB_ENV
jobBuild="$(
echo '${{ env.JOB_OUTPUT }}' |
jq '.JOB_BUILD'
)"
echo 'JOB_BUILD='$jobBuild >> $GITHUB_ENV
deployUrl="$(
echo '${{ env.JOB_OUTPUT }}' |
jq '.DEPLOY_URL'
)"
echo 'DEPLOY_URL='$deployUrl >> $GITHUB_ENV
- name: Adding Job Summary
run: |
echo "| Command | Status |" >> $GITHUB_STEP_SUMMARY
echo "| ---- | ---- |" >> $GITHUB_STEP_SUMMARY
if [ ${{ env.JOB_LINT }} == success ]; then
echo "| Lint | ✅ |" >> $GITHUB_STEP_SUMMARY
else
echo "| Lint | ❌ |" >> $GITHUB_STEP_SUMMARY
fi
if [ ${{ env.JOB_BUILD }} == success ]; then
echo "| Build | ✅ |" >> $GITHUB_STEP_SUMMARY
else
echo "| Build | ❌ |" >> $GITHUB_STEP_SUMMARY
fi
- name: Adding Job Summary Deploy Url
if: ${{ env.DEPLOY_URL }}
run: echo "| URL | ${{ env.DEPLOY_URL }} |" >> $GITHUB_STEP_SUMMARY