From 78fbb628c9d4f957fd35d866b44f50294cf27d1b Mon Sep 17 00:00:00 2001 From: Elliot Braem <16282460+elliotBraem@users.noreply.github.com> Date: Thu, 9 Nov 2023 00:10:54 +0000 Subject: [PATCH] feat: adds workflows --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++ .github/ISSUE_TEMPLATE/feature-request.md | 20 +++ .github/workflows/release.yml | 35 +++++ .github/workflows/testnet.yml | 35 +++++ apps/homepage/bos.config.json | 2 +- apps/homepage/widget/WidgetMetadataEditor.jsx | 2 +- apps/homepage/widget/community/join.jsx | 147 ------------------ apps/homepage/widget/home.jsx | 2 +- apps/homepage/widget/propose.jsx | 2 +- 9 files changed, 132 insertions(+), 151 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/testnet.yml delete mode 100644 apps/homepage/widget/community/join.jsx diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..f3d5c415 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 00000000..11fc491e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..edbc59b0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Deploy Components to Mainnet +on: + push: + branches: [main] +jobs: + deploy-widgets: + runs-on: ubuntu-latest + name: Deploy widgets to social.near (mainnet) + env: + BOS_DEPLOY_ACCOUNT_ID: ${{ vars.BOS_DEPLOY_ACCOUNT_ID }} + BOS_SIGNER_ACCOUNT_ID: ${{ vars.BOS_SIGNER_ACCOUNT_ID }} + BOS_SIGNER_PUBLIC_KEY: ${{ vars.BOS_SIGNER_PUBLIC_KEY }} + BOS_SIGNER_PRIVATE_KEY: ${{ secrets.BOS_SIGNER_PRIVATE_KEY }} + NETWORK_ID: mainnet + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install near-social CLI + run: | + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.1/bos-cli-v0.3.1-installer.sh | sh + + - name: Install bos-workspace from dev branch + run: | + npm install https://github.com/NEARBuilders/bos-workspace.git#dev + + - name: Build the workspaces + run: | + npm run bosworkspace build + + - name: Deploy widgets + working-directory: ./build/homepage + run: | + bos components deploy "$BOS_DEPLOY_ACCOUNT_ID" sign-as "$BOS_SIGNER_ACCOUNT_ID" network-config mainnet sign-with-plaintext-private-key --signer-public-key "$BOS_SIGNER_PUBLIC_KEY" --signer-private-key "$BOS_SIGNER_PRIVATE_KEY" send diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml new file mode 100644 index 00000000..e39eacc5 --- /dev/null +++ b/.github/workflows/testnet.yml @@ -0,0 +1,35 @@ +name: Deploy Components to Testnet +on: + push: + branches: [feature/testnet-deploy] +jobs: + deploy-widgets: + runs-on: ubuntu-latest + name: Deploy widgets to social.near (testnet) + env: + BOS_DEPLOY_ACCOUNT_ID: ${{ vars.TESTNET_DEPLOY_ACCOUNT_ID }} + BOS_SIGNER_ACCOUNT_ID: ${{ vars.TESTNET_SIGNER_ACCOUNT_ID }} + BOS_SIGNER_PUBLIC_KEY: ${{ vars.TESTNET_SIGNER_PUBLIC_KEY }} + BOS_SIGNER_PRIVATE_KEY: ${{ secrets.TESTNET_SIGNER_PRIVATE_KEY }} + NETWORK_ID: testnet + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install near-social CLI + run: | + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.1/bos-cli-v0.3.1-installer.sh | sh + + - name: Install bos-workspace from dev branch + run: | + npm install https://github.com/NEARBuilders/bos-workspace.git#dev + + - name: Build the workspaces + run: | + npm run bosworkspace build + + - name: Deploy widgets + working-directory: ./build/canvas + run: | + bos components deploy "$BOS_DEPLOY_ACCOUNT_ID" sign-as "$BOS_SIGNER_ACCOUNT_ID" network-config testnet sign-with-plaintext-private-key --signer-public-key "$BOS_SIGNER_PUBLIC_KEY" --signer-private-key "$BOS_SIGNER_PRIVATE_KEY" send diff --git a/apps/homepage/bos.config.json b/apps/homepage/bos.config.json index 45125157..9db549a9 100644 --- a/apps/homepage/bos.config.json +++ b/apps/homepage/bos.config.json @@ -1,3 +1,3 @@ { - "appAccount": "builddao.near" + "appAccount": "buildhub.near" } \ No newline at end of file diff --git a/apps/homepage/widget/WidgetMetadataEditor.jsx b/apps/homepage/widget/WidgetMetadataEditor.jsx index 34c6d5c9..0fe292f9 100644 --- a/apps/homepage/widget/WidgetMetadataEditor.jsx +++ b/apps/homepage/widget/WidgetMetadataEditor.jsx @@ -10,7 +10,7 @@ if (metadata === null) { return ( role.name === roleId) - .map((role) => role.kind.Group); - -// get data from last proposal -const proposal = Near.view(daoId, "get_proposal", { - id: proposalId, -}); - -if (proposal === null) { - return ""; -} - -// check if the potential member submitted last proposal -const canJoin = accountId && accountId !== proposal.proposer; - -const handleJoin = () => { - Near.call([ - { - contractName: daoId, - methodName: "add_proposal", - args: { - proposal: { - description: `add ${accountId} to the ${roleId} group`, - kind: { - AddMemberToRole: { - member_id: accountId, - role: roleId, - }, - }, - }, - }, - gas: 219000000000000, - deposit: deposit, - }, - ]); -}; - -const groupMembers = group.join(", "); - -const checkMembership = (groupMembers) => { - if (groupMembers.indexOf(accountId) !== -1) { - return State.update({ isMember: true }); - } -}; - -const validMember = checkMembership(groupMembers); - -// check if the potential member is a verified human -let human = false; -const userSBTs = Near.view("registry.i-am-human.near", "sbt_tokens_by_owner", { - account: accountId, -}); - -for (let i = 0; i < userSBTs.length; i++) { - if ("fractal.i-am-human.near" == userSBTs[i][0]) { - human = true; - } -} - -// check if the potential member is connected -const connectEdge = Social.keys( - `${accountId}/graph/connect/${daoId}`, - undefined, - { - values_only: true, - } -); - -const loading = connectEdge === null || inverseEdge === null; -const isConnected = connectEdge && Object.keys(connectEdge).length; - -return ( -
- {!isConnected ? ( - - ) : ( - <> - {!validMember ? ( - <> - {canJoin ? ( - - ) : ( - <> - - - Customize - - - )} - - ) : ( - <> - - - Customize - - - )} - - )} -
-); diff --git a/apps/homepage/widget/home.jsx b/apps/homepage/widget/home.jsx index db50e0b5..d486bfab 100644 --- a/apps/homepage/widget/home.jsx +++ b/apps/homepage/widget/home.jsx @@ -1,4 +1,4 @@ -const ownerId = "builddao.near"; +const ownerId = "/*__@appAccount__*/"; const Root = styled.div` background-color: #0b0c14; diff --git a/apps/homepage/widget/propose.jsx b/apps/homepage/widget/propose.jsx index d34b1891..7c1eda86 100644 --- a/apps/homepage/widget/propose.jsx +++ b/apps/homepage/widget/propose.jsx @@ -191,7 +191,7 @@ return ( ) : ( - + )}