|
| 1 | +name: Deploy to staging |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - web4contract/** |
| 6 | + |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + working-directory: ./web4contract |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + uses: ./.github/workflows/web4-test.yml |
| 14 | + |
| 15 | + deploy-staging: |
| 16 | + name: Deploy to staging subaccount |
| 17 | + permissions: |
| 18 | + pull-requests: write |
| 19 | + needs: [test] |
| 20 | + runs-on: ubuntu-latest |
| 21 | + env: |
| 22 | + NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Install near CLI |
| 29 | + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.11.1/near-cli-rs-installer.sh | sh |
| 30 | + - name: Create staging account |
| 31 | + if: github.event.action == 'opened' || github.event.action == 'reopened' |
| 32 | + run: | |
| 33 | + near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '10 NEAR' \ |
| 34 | + use-manually-provided-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \ |
| 35 | + sign-as "${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}" \ |
| 36 | + network-config "testnet" \ |
| 37 | + sign-with-plaintext-private-key \ |
| 38 | + --signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \ |
| 39 | + --signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \ |
| 40 | + send |
| 41 | +
|
| 42 | + - name: Install cargo-near CLI |
| 43 | + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.6.2/cargo-near-installer.sh | sh |
| 44 | + - name: Deploy to staging |
| 45 | + run: | |
| 46 | + cargo near deploy "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \ |
| 47 | + without-init-call \ |
| 48 | + network-config "testnet" \ |
| 49 | + sign-with-plaintext-private-key \ |
| 50 | + --signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \ |
| 51 | + --signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \ |
| 52 | + send |
| 53 | +
|
| 54 | + - name: Comment on pull request |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ github.token }} |
| 57 | + run: | |
| 58 | + gh pr comment "${{ github.event.number }}" --body "Staging contract is deployed to ["'`'"${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}"'`'" account](https://explorer.testnet.near.org/accounts/${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }})" |
0 commit comments