forked from cerc-io/snowballtools-base
temp commit
All checks were successful
Deploy Snowball frontend / deploy (20.x) (push) Successful in 24s
All checks were successful
Deploy Snowball frontend / deploy (20.x) (push) Successful in 24s
This commit is contained in:
parent
cbc00a5902
commit
3ec547a043
@ -3,7 +3,7 @@ name: Deploy Snowball frontend
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- ag-frontend-ci
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@ -29,9 +29,9 @@ jobs:
|
|||||||
- name: Set up environment
|
- name: Set up environment
|
||||||
run: |
|
run: |
|
||||||
# Create a .env file with the necessary environment variables from GitHub secrets
|
# Create a .env file with the necessary environment variables from GitHub secrets
|
||||||
echo "REGISTRY_BOND_ID=${{ secrets.REGISTRY_BOND_ID }}" > .env
|
echo "REGISTRY_BOND_ID=${{ secrets.REGISTRY_BOND_ID }}" > packages/deployer/.env
|
||||||
echo "DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" >> .env
|
echo "DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" >> packages/deployer/.env
|
||||||
echo "AUTHORITY=laconic-deploy" >> .env
|
echo "AUTHORITY=laconic-deploy" >> packages/deployer/.env
|
||||||
|
|
||||||
# Create a config file with necessary endpoints and placeholders for secrets
|
# Create a config file with necessary endpoints and placeholders for secrets
|
||||||
cat > packages/deployer/config.yml <<EOF
|
cat > packages/deployer/config.yml <<EOF
|
||||||
@ -47,4 +47,5 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Deploy Script
|
- name: Run Deploy Script
|
||||||
run: |
|
run: |
|
||||||
packages/deployer/deploy-frontend.sh
|
cd packages/deployer
|
||||||
|
./deploy-frontend.sh
|
||||||
|
@ -44,72 +44,77 @@ EOF
|
|||||||
echo "Files generated successfully"
|
echo "Files generated successfully"
|
||||||
|
|
||||||
RECORD_FILE=records/application-record.yml
|
RECORD_FILE=records/application-record.yml
|
||||||
|
echo "Application record: "
|
||||||
|
cat $RECORD_FILE
|
||||||
|
|
||||||
# Publish ApplicationRecord
|
# Publish ApplicationRecord
|
||||||
publish_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE)
|
# publish_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE)
|
||||||
rc=$?
|
# rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to publish record"
|
# echo "FATAL: Failed to publish record"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
RECORD_ID=$(echo $publish_response | jq -r '.id')
|
# RECORD_ID=$(echo $publish_response | jq -r '.id')
|
||||||
echo "ApplicationRecord published"
|
# echo "ApplicationRecord published"
|
||||||
echo $RECORD_ID
|
# echo $RECORD_ID
|
||||||
|
|
||||||
# Set name to record
|
# Set name to record
|
||||||
REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/deploy-frontend"
|
# REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/deploy-frontend"
|
||||||
|
|
||||||
sleep 2
|
# sleep 2
|
||||||
yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID"
|
# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID"
|
||||||
rc=$?
|
# rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to set name: $REGISTRY_APP_LRN@${PACKAGE_VERSION}"
|
# echo "FATAL: Failed to set name: $REGISTRY_APP_LRN@${PACKAGE_VERSION}"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
sleep 2
|
# sleep 2
|
||||||
yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${LATEST_HASH}" "$RECORD_ID"
|
# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${LATEST_HASH}" "$RECORD_ID"
|
||||||
rc=$?
|
# rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to set hash"
|
# echo "FATAL: Failed to set hash"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
sleep 2
|
# sleep 2
|
||||||
# Set name if latest release
|
# # Set name if latest release
|
||||||
yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN" "$RECORD_ID"
|
# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN" "$RECORD_ID"
|
||||||
rc=$?
|
# rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to set release"
|
# echo "FATAL: Failed to set release"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
echo "$REGISTRY_APP_LRN set for ApplicationRecord"
|
# echo "$REGISTRY_APP_LRN set for ApplicationRecord"
|
||||||
|
|
||||||
# Check if record found for REGISTRY_APP_LRN
|
# # Check if record found for REGISTRY_APP_LRN
|
||||||
query_response=$(yarn --silent laconic -c $CONFIG_FILE registry name resolve "$REGISTRY_APP_LRN")
|
# query_response=$(yarn --silent laconic -c $CONFIG_FILE registry name resolve "$REGISTRY_APP_LRN")
|
||||||
rc=$?
|
# rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to query name"
|
# echo "FATAL: Failed to query name"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
APP_RECORD=$(echo $query_response | jq '.[0]')
|
# APP_RECORD=$(echo $query_response | jq '.[0]')
|
||||||
if [ -z "$APP_RECORD" ] || [ "null" == "$APP_RECORD" ]; then
|
# if [ -z "$APP_RECORD" ] || [ "null" == "$APP_RECORD" ]; then
|
||||||
echo "No record found for $REGISTRY_APP_LRN."
|
# echo "No record found for $REGISTRY_APP_LRN."
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Get payment address for deployer
|
# Get payment address for deployer
|
||||||
paymentAddress=$(yarn --silent laconic -c config.yml registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.paymentAddress')
|
paymentAddress=$(yarn --silent laconic -c config.yml registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.paymentAddress')
|
||||||
paymentAmount=$(yarn --silent laconic -c config.yml registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.minimumPayment' | sed 's/alnt//g')
|
paymentAmount=$(yarn --silent laconic -c config.yml registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.minimumPayment' | sed 's/alnt//g')
|
||||||
|
|
||||||
|
echo "Paying address: $paymentAddress with amount $paymentAmount..."
|
||||||
|
|
||||||
# Pay deployer if paymentAmount is not null
|
# Pay deployer if paymentAmount is not null
|
||||||
if [[ -n "$paymentAmount" && "$paymentAmount" != "null" ]]; then
|
# if [[ -n "$paymentAmount" && "$paymentAmount" != "null" ]]; then
|
||||||
payment=$(yarn --silent laconic -c config.yml registry tokens send --address "$paymentAddress" --type alnt --quantity "$paymentAmount")
|
# payment=$(yarn --silent laconic -c config.yml registry tokens send --address "$paymentAddress" --type alnt --quantity "$paymentAmount")
|
||||||
|
|
||||||
# Extract the transaction hash
|
# # Extract the transaction hash
|
||||||
txHash=$(echo "$payment" | jq -r '.tx.hash')
|
# txHash=$(echo "$payment" | jq -r '.tx.hash')
|
||||||
echo "Paid deployer with txHash as $txHash"
|
# echo "Paid deployer with txHash as $txHash"
|
||||||
|
|
||||||
else
|
# else
|
||||||
echo "Payment amount is null; skipping payment."
|
# echo "Payment amount is null; skipping payment."
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Generate application-deployment-request.yml
|
# Generate application-deployment-request.yml
|
||||||
cat >./records/application-deployment-request.yml <<EOF
|
cat >./records/application-deployment-request.yml <<EOF
|
||||||
@ -136,13 +141,15 @@ record:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
RECORD_FILE=records/application-deployment-request.yml
|
RECORD_FILE=records/application-deployment-request.yml
|
||||||
|
echo "Application deployment request"
|
||||||
|
cat $RECORD_FILE
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
deployment_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE)
|
# deployment_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE)
|
||||||
if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
echo "FATAL: Failed to query deployment request"
|
# echo "FATAL: Failed to query deployment request"
|
||||||
exit $rc
|
# exit $rc
|
||||||
fi
|
# fi
|
||||||
DEPLOYMENT_REQUEST_ID=$(echo $deployment_response | jq -r '.id')
|
# DEPLOYMENT_REQUEST_ID=$(echo $deployment_response | jq -r '.id')
|
||||||
echo "ApplicationDeploymentRequest published"
|
# echo "ApplicationDeploymentRequest published"
|
||||||
echo $DEPLOYMENT_REQUEST_ID
|
# echo $DEPLOYMENT_REQUEST_ID
|
||||||
|
Loading…
Reference in New Issue
Block a user