From f08a40c03030be19b7ad7fa43a29bc6ff4162791 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:33:33 +0530 Subject: [PATCH 1/3] update deploy script --- .github/workflows/deploy-prod-mainnet.yml | 24 +++++++++++++---------- instances/treasury-devdao.near/src | 1 + package.json | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) create mode 120000 instances/treasury-devdao.near/src diff --git a/.github/workflows/deploy-prod-mainnet.yml b/.github/workflows/deploy-prod-mainnet.yml index c85d4d07..53b7c081 100644 --- a/.github/workflows/deploy-prod-mainnet.yml +++ b/.github/workflows/deploy-prod-mainnet.yml @@ -4,13 +4,17 @@ on: branches: [main] jobs: deploy-mainnet: - uses: NEARBuilders/bos-workspace/.github/workflows/deploy.yml@main - with: - bw-legacy: false - deploy-env: "mainnet" - app-name: "[APP_NAME]" - deploy-account-address: "[DEPLOY_ACCOUNT]" - signer-account-address: "[SIGNER_ACCOUNT]" - signer-public-key: [PUBLIC_KEY] - secrets: - SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }} + name: Deploy components to social.near (mainnet) + runs-on: ubuntu-latest + environment: treasury-devdao.near + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dependencies + run: npm ci + - name: Build components + run: npm run bw:build:treasury + - name: Navigate to build directory + run: cd ./build/treasury-devdao.near + - name: Deploy components + run: npm run deploy -- '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send diff --git a/instances/treasury-devdao.near/src b/instances/treasury-devdao.near/src new file mode 120000 index 00000000..0301008c --- /dev/null +++ b/instances/treasury-devdao.near/src @@ -0,0 +1 @@ +widget \ No newline at end of file diff --git a/package.json b/package.json index 3a59d88b..5515faa8 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "npm run fmt", "prepare": "husky install", "bw:dev:treasury": "bw dev instances/treasury-devdao.near", - "bw:build:treasury": "bw build instances/treasury-devdao.near", + "bw:build:treasury": "bw build instances/treasury-devdao.near build/treasury-devdao.near && mv build/treasury-devdao.near/src/widget/* build/treasury-devdao.near/src/ && rm -Rf build/treasury-devdao.near/src/widget", "gateway:treasury": "node scripts/dev-gateway.js treasury-devdao.near", "test": "npx playwright test", "test:watch:codespaces": "npm test -- --ui-host=0.0.0.0" @@ -58,7 +58,7 @@ "typescript", "starter" ], - "author": "devhub.near", + "author": "treasury-devdao.near", "license": "MIT", "bugs": { "url": "https://github.com/NEAR-DevHub/neardevhub-treasury-dashboard.git" From add6fb93d3de849437efdba875cacf5165deb554 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:03:28 +0530 Subject: [PATCH 2/3] add deploy cmd --- .github/workflows/deploy-prod-mainnet.yml | 4 ---- package.json | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy-prod-mainnet.yml b/.github/workflows/deploy-prod-mainnet.yml index 53b7c081..2500c4df 100644 --- a/.github/workflows/deploy-prod-mainnet.yml +++ b/.github/workflows/deploy-prod-mainnet.yml @@ -12,9 +12,5 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies run: npm ci - - name: Build components - run: npm run bw:build:treasury - - name: Navigate to build directory - run: cd ./build/treasury-devdao.near - name: Deploy components run: npm run deploy -- '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send diff --git a/package.json b/package.json index 5515faa8..c0918de8 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "bw:build:treasury": "bw build instances/treasury-devdao.near build/treasury-devdao.near && mv build/treasury-devdao.near/src/widget/* build/treasury-devdao.near/src/ && rm -Rf build/treasury-devdao.near/src/widget", "gateway:treasury": "node scripts/dev-gateway.js treasury-devdao.near", "test": "npx playwright test", + "deploy": "npm run bw:build:treasury && cd ./build/treasury-devdao.near && bos components deploy", "test:watch:codespaces": "npm test -- --ui-host=0.0.0.0" }, "husky": { From 9a47a4d084f6ac7ffc3d8b06a6c0c0a923c21d2f Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:07:00 +0530 Subject: [PATCH 3/3] add dry run --- .github/workflows/deploy-prod-mainnet.yml | 13 +++++++++++-- package.json | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-prod-mainnet.yml b/.github/workflows/deploy-prod-mainnet.yml index 2500c4df..b908a9a4 100644 --- a/.github/workflows/deploy-prod-mainnet.yml +++ b/.github/workflows/deploy-prod-mainnet.yml @@ -1,5 +1,6 @@ name: Deploy Components to Mainnet on: + pull_request: push: branches: [main] jobs: @@ -12,5 +13,13 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies run: npm ci - - name: Deploy components - run: npm run deploy -- '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send + - name: Deploy widgets + run: | + BRANCH="$(git rev-parse --abbrev-ref HEAD)" + echo "on branch $BRANCH" + if [[ "$BRANCH" != "main" ]]; then + echo "Not on main branch, dry run by diff with treasury-devdao.near" + npm run dry-run:treasury + else + npm run deploy:treasury -- '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send + fi diff --git a/package.json b/package.json index c0918de8..cfcc9fba 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,9 @@ "bw:dev:treasury": "bw dev instances/treasury-devdao.near", "bw:build:treasury": "bw build instances/treasury-devdao.near build/treasury-devdao.near && mv build/treasury-devdao.near/src/widget/* build/treasury-devdao.near/src/ && rm -Rf build/treasury-devdao.near/src/widget", "gateway:treasury": "node scripts/dev-gateway.js treasury-devdao.near", + "deploy:treasury": "npm run bw:build:treasury && cd ./build/treasury-devdao.near && bos components deploy", + "dry-run:treasury": "npm run bw:build:treasury && cd ./build/treasury-devdao.near && bos components diff treasury-devdao.near network-config mainnet", "test": "npx playwright test", - "deploy": "npm run bw:build:treasury && cd ./build/treasury-devdao.near && bos components deploy", "test:watch:codespaces": "npm test -- --ui-host=0.0.0.0" }, "husky": {