Deploy Playground, Signer and Dapp apps. #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |