-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (62 loc) · 1.96 KB
/
deploy-example.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
name: Deploy Playground, Signer and Dapp apps.
on:
workflow_dispatch:
inputs:
network:
description: 'Network:'
required: true
type: choice
options:
- dev
- ic
env:
NETWORK: ${{ github.event.inputs.network }}
jobs:
deploy:
name: Deploy
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Setup DFX 15
uses: dfinity/setup-dfx@main
with:
dfx-version: 0.15.3
- name: Install dependencies
run: npm install --frozen-lockfile
- name: Build
run: npm run build-playground:"${NETWORK}"
- name: Setup DFX Identity
run: |
if [[ "${NETWORK}" == 'dev' ]]; then
ID_NAME="icrc25_dev_identity"
IDENTITY_PEM_NAME_VAR="ICRC25_DEV_IDENTITY"
elif [ "${NETWORK}" == 'ic' ]; then
ID_NAME="icrc25_prod_identity"
IDENTITY_PEM_NAME_VAR="ICRC25_PROD_IDENTITY"
fi
ID_PATH="$HOME/.config/dfx/identity/${ID_NAME}"
mkdir -p "${ID_PATH}"
echo "${!IDENTITY_PEM_NAME_VAR}" | base64 -d > "${ID_PATH}/identity.pem"
dfx identity use "${ID_NAME}"
env:
ICRC25_DEV_IDENTITY: ${{secrets.ICRC25_DEV_IDENTITY}}
ICRC25_PROD_IDENTITY: ${{secrets.ICRC25_PROD_IDENTITY}}
- name: Deploy
run: |
echo "dfx deploy signer --network "${NETWORK}"" >&2
if ! result=$(dfx deploy signer --yes --network "${NETWORK}"); then
echo "Deploy failed ${result}" >&2
exit 1
fi
echo "dfx deploy dapp --network "${NETWORK}"" >&2
if ! result=$(dfx deploy dapp --yes --network "${NETWORK}"); then
echo "Deploy failed ${result}" >&2
exit 1
fi