diff --git a/.github/workflows/deploy-dev-widgets.yml b/.github/workflows/deploy-dev-widgets.yml index 5d0327275..94b80c8d4 100644 --- a/.github/workflows/deploy-dev-widgets.yml +++ b/.github/workflows/deploy-dev-widgets.yml @@ -1,7 +1,7 @@ name: Deploy Dev Components to Mainnet on: push: - branches: [main] + branches: [feat/use-replacement-maps] paths: - "frontend/widgets/**" jobs: @@ -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 }} diff --git a/.github/workflows/deploy-prod-widgets.yml b/.github/workflows/deploy-prod-widgets.yml index d847626bd..9bdbdcd54 100644 --- a/.github/workflows/deploy-prod-widgets.yml +++ b/.github/workflows/deploy-prod-widgets.yml @@ -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 }} diff --git a/.github/workflows/deploy-widgets.yml b/.github/workflows/deploy-widgets.yml index d57dac082..548bcc7e8 100644 --- a/.github/workflows/deploy-widgets.yml +++ b/.github/workflows/deploy-widgets.yml @@ -30,13 +30,28 @@ jobs: 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)]' replacements.${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