-
Notifications
You must be signed in to change notification settings - Fork 113
93 lines (83 loc) · 2.99 KB
/
app-deploy-preview.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
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
name: Deploy App to Preview
"on":
workflow_dispatch:
inputs:
version:
type: string
description: "A release version to deploy, e.g. v2.0.0"
required: true
default: "v2.0.0"
jobs:
deploy:
name: Deploy
runs-on: matterlabs-firebase-deployer
permissions:
contents: read
outputs:
dappUrl: ${{ steps.check_channel.outputs.channel_url }}
env:
CHANNEL_NAME: ${{ github.event.inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Firebase CLI and auth
run: |
npm install -g firebase-tools
- name: Download Dist package
uses: dsaltares/fetch-gh-release-asset@master
with:
version: "tags/${{ github.event.inputs.version }}"
file: "dist.zip"
target: "dist.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip Dist package
run: |
unzip dist.zip -d packages/app
- name: Download Storybook package
uses: dsaltares/fetch-gh-release-asset@master
with:
version: "tags/${{ github.event.inputs.version }}"
file: "storybook-static.zip"
target: "storybook-static.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip Storybook package
run: |
unzip storybook-static.zip -d packages/app
- name: Check if Firebase Hosting channel exists
working-directory: ./packages/app
id: check_channel
run: |
CHANNEL_URL=$(firebase --project scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url')
if [ -z "$CHANNEL_URL" ]; then
echo "New channel"
firebase --project scan-v2 hosting:channel:create $CHANNEL_NAME
CHANNEL_URL=$(firebase --project scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url')
fi
echo "channel_url=${CHANNEL_URL}" >> $GITHUB_OUTPUT
- name: Deploy
working-directory: ./packages/app
run: |
firebase --project scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }}
- name: Output version url on success
run: |
run: |
echo "Block explorer app has been deployed to: ${{ steps.check_channel.outputs.channel_url }}
mainnet:
needs: deploy
name: Staging on Mainnet + Sepolia
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: write
with:
targetUrl: ${{ needs.deploy.outputs.dappUrl }}
testnet_network_value_for_e2e: "/?network=sepolia"
default_network_value_for_e2e: "/?network=mainnet"
publish_to_allure: true
environmentTags: "and not @featureEnv"