Skip to content

Commit

Permalink
deploy.yml flow
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdas committed Mar 6, 2024
1 parent e4cdbea commit 8c6e71c
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 4 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Deploy BOS dApp (built using Alem)
on:
workflow_call:
inputs:
cli-version:
required: false
description: "Version of BOS CLI to use for deploy (e.g. 0.3.0)"
type: string
default: "0.3.6"
deploy-env:
required: false
description: "Environment to deploy component code to (e.g. mainnet, testnet)"
type: string
default: "mainnet"
app-name:
required: true
description: "Workspace app name to deploy (from /apps directory)"
type: string
working-directory:
required: false
description: "Relative path to root"
type: string
default: "./"
deploy-account-address:
required: true
description: "Account under which component code should be deployed"
type: string
signer-account-address:
required: true
description: "Account which will be used for signing deploy transaction, frequently the same as deploy-account-address"
type: string
signer-public-key:
required: true
description: "Public key for signing transactions in the format: `ed25519:<public_key>`"
type: string
secrets:
SIGNER_PRIVATE_KEY:
description: "Private key in `ed25519:<private_key>` format for signing transaction"
required: true

jobs:
deploy-widgets:
runs-on: ubuntu-latest
name: Deploy Widgets
env:
DEPLOY_ENV: ${{ inputs.deploy-env }}
WORKSPACE_DIRECTORY: ${{ inputs.working-directory }}
DEPLOY_ACCOUNT_ID: ${{ inputs.deploy-account-address }}
SIGNER_ACCOUNT_ID: ${{ inputs.signer-account-address }}
SIGNER_PUBLIC_KEY: ${{ inputs.signer-public-key }}
SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install bos-cli-rs
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v${{ inputs.cli-version }}/bos-cli-installer.sh | sh
- name: Configure non-archival RPC endpoint
run: |
mkdir -p ~/.config/near-cli
touch ~/.config/near-cli/config.toml
echo -e "credentials_home_dir = \"/home/runner/.near-credentials\"\n[network_connection.mainnet]\nnetwork_name = \"mainnet\"\nrpc_url = \"https://rpc.mainnet.near.org/\"\nwallet_url = \"https://app.mynearwallet.com/\"\nexplorer_transaction_url = \"https://nearblocks.io/txns/\"" > ~/.config/near-cli/config.toml
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install Alem globally
run: |
npm install alem -g
- name: Build the workspaces
run: |
cd "$WORKSPACE_DIRECTORY"
alem build
- name: Deploy widgets (using bos-cli-rs)
run: |
pwd
cd "$WORKSPACE_DIRECTORY/build"
bos components deploy "$DEPLOY_ACCOUNT_ID" sign-as "$SIGNER_ACCOUNT_ID" network-config "$DEPLOY_ENV" sign-with-plaintext-private-key --signer-public-key "$SIGNER_PUBLIC_KEY" --signer-private-key "$SIGNER_PRIVATE_KEY" send
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ NOTES.txt
OLD_README.md

# misc
.DS_Store

# temp
/.github/workflows/deploy.yml
.DS_Store

0 comments on commit 8c6e71c

Please sign in to comment.