44
55permissions :
66 contents : read
7- id-token : write # Required for workflows that call test.yml (Codecov OIDC)
8- pull-requests : write # Required for deployment comments
7+ id-token : write # Required for workflows that call test.yml (Codecov OIDC)
8+ pull-requests : write # Required for deployment comments
99
1010jobs :
1111 # Check if we need to run contract-related jobs
@@ -72,11 +72,11 @@ jobs:
7272
7373 - name : Initialize staging account
7474 run : |
75- EXISTS =$(./script/ci/account-exists.sh \
75+ ACCOUNT_EXISTS =$(./script/ci/account-exists.sh \
7676 --account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
7777 --network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}")
7878
79- if [[ -z "$EXISTS " ]]; then
79+ if [[ -z "$ACCOUNT_EXISTS " ]]; then
8080 echo "Account does not already exist, creating"
8181
8282 near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '20 NEAR' \
@@ -88,19 +88,26 @@ jobs:
8888
8989 echo "NEWLY_CREATED=1" >> $GITHUB_ENV
9090 else
91- echo "Account already exists, adding tokens and removing old market versions"
92-
9391 near tokens "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}" \
9492 send-near "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '6 NEAR' \
9593 network-config "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
9694 sign-with-plaintext-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \
9795 send
9896
99- ./script/ci/remove-all-versions-from-registry.sh \
100- --account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
101- --registry "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
102- --network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
103- --private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}"
97+ CONTRACT_EXISTS=$(./script/ci/contract-exists.sh \
98+ --contract "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
99+ --network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}")
100+
101+ if [[ -n "$CONTRACT_EXISTS" ]]; then
102+ echo "Contract already exists on staging account, removing old market versions"
103+ # ./script/ci/remove-all-versions-from-registry.sh \
104+ # --account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
105+ # --registry "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
106+ # --network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
107+ # --private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}"
108+ else
109+ echo "NEWLY_CREATED=1" >> $GITHUB_ENV
110+ fi
104111 fi
105112
106113 - name : Deploy registry to staging account
0 commit comments