Skip to content

Commit

Permalink
ci: Updating authenticate step in release-acceptance
Browse files Browse the repository at this point in the history
Signed-off-by: Vasil Boyadzhiev <[email protected]>
  • Loading branch information
san-est committed Oct 28, 2024
1 parent e4e63b2 commit 58c9f9e
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/release-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,24 @@ jobs:
egress-policy: audit

- name: Authenticate
env:
HEDERA_PORTAL_USER: ${{ secrets.HEDERA_PORTAL_USER }}
HEDERA_PORTAL_PASSWORD: ${{ secrets.HEDERA_PORTAL_PASSWORD }}
run: |
RESPONSE=$(jq --null-input -r --arg USER "${{ secrets.HEDERA_PORTAL_USER }}" --arg PASS "${{ secrets.HEDERA_PORTAL_PASSWORD }}" '{"email": $USER, "password": $PASS}' | curl -sSL -c /tmp/cookiejar.bin --data @- -X POST -H "Accept: application/json" -H "Content-Type: application/json" https://portal.hedera.com/api/session)
echo "::add-mask::$RESPONSE"
echo "The response was: $RESPONSE"
ACCOUNTS_JSON="$(curl -sSL -b /tmp/cookiejar.bin -H "Accept: application/json" https://portal.hedera.com/api/account)"
echo "::add-mask::$ACCOUNTS_JSON"
TESTNET_ACCOUNT=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .accountNum')
echo "The testnet account is: $TESTNET_ACCOUNT"
PUBLIC_KEY=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .publicKey')
echo "The publicKey is: $PUBLIC_KEY"
PRIVATE_KEY=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .privateKey')
echo "::add-mask::$PRIVATE_KEY"
echo "The privateKey is: $PRIVATE_KEY"
echo "OPERATOR_ID_MAIN=0.0.${TESTNET_ACCOUNT}" >> $GITHUB_ENV
echo "OPERATOR_KEY_MAIN=${PRIVATE_KEY}" >> $GITHUB_ENV
RESPONSE=$(jq --null-input -r --arg USER "${HEDERA_PORTAL_USER}" --arg PASS "${HEDERA_PORTAL_PASSWORD}" '{"email": $USER, "password": $PASS}' | curl -sSL -c /tmp/cookiejar.bin --data @- -X POST -H "Accept: application/json" -H "Content-Type: application/json" https://portal.hedera.com/api/session)
echo "::add-mask::$RESPONSE"
echo "The response was: $RESPONSE"
ACCOUNTS_JSON="$(curl -sSL -b /tmp/cookiejar.bin -H "Accept: application/json" https://portal.hedera.com/api/account)"
echo "::add-mask::$ACCOUNTS_JSON"
TESTNET_ACCOUNT=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .accountNum')
echo "The testnet account is: $TESTNET_ACCOUNT"
PUBLIC_KEY=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .publicKey')
echo "The publicKey is: $PUBLIC_KEY"
PRIVATE_KEY=$(echo $ACCOUNTS_JSON | jq -r '.accounts[] | select(.network=="testnet") | .privateKey')
echo "::add-mask::$PRIVATE_KEY"
echo "The privateKey is: $PRIVATE_KEY"
echo "OPERATOR_ID_MAIN=0.0.${TESTNET_ACCOUNT}" >> $GITHUB_ENV
echo "OPERATOR_KEY_MAIN=${PRIVATE_KEY}" >> $GITHUB_ENV
- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
Expand Down

0 comments on commit 58c9f9e

Please sign in to comment.