Skip to content

Commit

Permalink
feat: update widgets ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
roshaans committed Aug 16, 2023
1 parent d95e3cc commit b613364
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy-dev-widgets.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy Dev Components to Mainnet
on:
push:
branches: [main]
branches: [feat/use-replacement-maps]
paths:
- "frontend/widgets/**"
jobs:
Expand All @@ -11,5 +11,6 @@ jobs:
directory-paths: ${{vars.WIDGETS_DIRECTORY_PATHS}}
deploy-account-address: ${{ vars.DEV_SIGNER_ACCOUNT_ID }}
signer-public-key: ${{ vars.DEV_SIGNER_PUBLIC_KEY }}
environment: dev
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.DEV_SIGNER_PRIVATE_KEY }}
1 change: 1 addition & 0 deletions .github/workflows/deploy-prod-widgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ jobs:
directory-paths: ${{vars.WIDGETS_DIRECTORY_PATHS}}
deploy-account-address: ${{ vars.PROD_SIGNER_ACCOUNT_ID }}
signer-public-key: ${{ vars.PROD_SIGNER_PUBLIC_KEY }}
environment: mainnet
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.PROD_SIGNER_PRIVATE_KEY }}
25 changes: 22 additions & 3 deletions .github/workflows/deploy-widgets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Components to Mainnet
name: Deploy Components
on:
workflow_call:
inputs:
Expand All @@ -19,24 +19,43 @@ on:
required: true
description: "Comma-separated paths to the directories that contain the code to be deployed"
type: string
environment:
required: true
description: "mainnet or dev"
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 to social.near (mainnet)
name: Deploy widgets to social.near
env:
BOS_DEPLOY_ACCOUNT_ID: ${{ inputs.deploy-account-address }}
BOS_SIGNER_PUBLIC_KEY: ${{ inputs.signer-public-key }}
BOS_SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}
DIRECTORY_PATHS: ${{ inputs.directory-paths }}
ENVIRONMENT: ${{inputs.environment}}
BOS_SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}

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

- name: Set replacements
id: set_replacements
run: |
cd "frontend/widgets/"
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value)]' ../replacement.${ENVIRONMENT}.json | tr -d "\n\r")" >> $GITHUB_OUTPUT
- name: Replace placeholders
uses: flcdrg/replace-multiple-action@v1
with:
files: '**/*.jsx'
find: '${{ steps.set_replacements.outputs.replacements }}'
prefix: '(^|.*)'
suffix: '($|.*)'

- name: Install near-social CLI
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v${{ inputs.cli-version }}/bos-cli-v${{ inputs.cli-version }}-installer.sh | sh
Expand Down

0 comments on commit b613364

Please sign in to comment.