diff --git a/.gitea/workflows/deploy-frontend.yaml b/.gitea/workflows/deploy-frontend.yaml index 7aac3cbf..6b3a7484 100644 --- a/.gitea/workflows/deploy-frontend.yaml +++ b/.gitea/workflows/deploy-frontend.yaml @@ -3,7 +3,7 @@ name: Deploy Snowball frontend on: push: branches: - - main + - ag-frontend-ci jobs: deploy: diff --git a/packages/deployer/deploy-frontend.sh b/packages/deployer/deploy-frontend.sh index 129d93f7..4e55c061 100755 --- a/packages/deployer/deploy-frontend.sh +++ b/packages/deployer/deploy-frontend.sh @@ -44,72 +44,74 @@ EOF echo "Files generated successfully" RECORD_FILE=records/application-record.yml +echo "Application record: " +cat $RECORD_FILE # Publish ApplicationRecord -publish_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE) -rc=$? -if [ $rc -ne 0 ]; then - echo "FATAL: Failed to publish record" - exit $rc -fi -RECORD_ID=$(echo $publish_response | jq -r '.id') -echo "ApplicationRecord published" -echo $RECORD_ID +# publish_response=$(yarn --silent laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE) +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "FATAL: Failed to publish record" +# exit $rc +# fi +# RECORD_ID=$(echo $publish_response | jq -r '.id') +# echo "ApplicationRecord published" +# echo $RECORD_ID # Set name to record -REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/deploy-frontend" +# REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/deploy-frontend" -sleep 2 -yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID" -rc=$? -if [ $rc -ne 0 ]; then - echo "FATAL: Failed to set name: $REGISTRY_APP_LRN@${PACKAGE_VERSION}" - exit $rc -fi -sleep 2 -yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${LATEST_HASH}" "$RECORD_ID" -rc=$? -if [ $rc -ne 0 ]; then - echo "FATAL: Failed to set hash" - exit $rc -fi -sleep 2 -# Set name if latest release -yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN" "$RECORD_ID" -rc=$? -if [ $rc -ne 0 ]; then - echo "FATAL: Failed to set release" - exit $rc -fi -echo "$REGISTRY_APP_LRN set for ApplicationRecord" +# sleep 2 +# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID" +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "FATAL: Failed to set name: $REGISTRY_APP_LRN@${PACKAGE_VERSION}" +# exit $rc +# fi +# sleep 2 +# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${LATEST_HASH}" "$RECORD_ID" +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "FATAL: Failed to set hash" +# exit $rc +# fi +# sleep 2 +# # Set name if latest release +# yarn --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN" "$RECORD_ID" +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "FATAL: Failed to set release" +# exit $rc +# fi +# echo "$REGISTRY_APP_LRN set for ApplicationRecord" -# Check if record found for REGISTRY_APP_LRN -query_response=$(yarn --silent laconic -c $CONFIG_FILE registry name resolve "$REGISTRY_APP_LRN") -rc=$? -if [ $rc -ne 0 ]; then - echo "FATAL: Failed to query name" - exit $rc -fi -APP_RECORD=$(echo $query_response | jq '.[0]') -if [ -z "$APP_RECORD" ] || [ "null" == "$APP_RECORD" ]; then - echo "No record found for $REGISTRY_APP_LRN." - exit 1 -fi +# # Check if record found for REGISTRY_APP_LRN +# query_response=$(yarn --silent laconic -c $CONFIG_FILE registry name resolve "$REGISTRY_APP_LRN") +# rc=$? +# if [ $rc -ne 0 ]; then +# echo "FATAL: Failed to query name" +# exit $rc +# fi +# APP_RECORD=$(echo $query_response | jq '.[0]') +# if [ -z "$APP_RECORD" ] || [ "null" == "$APP_RECORD" ]; then +# echo "No record found for $REGISTRY_APP_LRN." +# exit 1 +# fi -# Get payment address for deployer -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') -# Pay deployer if paymentAmount is not null -if [[ -n "$paymentAmount" && "$paymentAmount" != "null" ]]; then - payment=$(yarn --silent laconic -c config.yml registry tokens send --address "$paymentAddress" --type alnt --quantity "$paymentAmount") +# # Get payment address for deployer +# 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') +# # Pay deployer if paymentAmount is not null +# if [[ -n "$paymentAmount" && "$paymentAmount" != "null" ]]; then +# payment=$(yarn --silent laconic -c config.yml registry tokens send --address "$paymentAddress" --type alnt --quantity "$paymentAmount") - # Extract the transaction hash - txHash=$(echo "$payment" | jq -r '.tx.hash') - echo "Paid deployer with txHash as $txHash" +# # Extract the transaction hash +# txHash=$(echo "$payment" | jq -r '.tx.hash') +# echo "Paid deployer with txHash as $txHash" -else - echo "Payment amount is null; skipping payment." -fi +# else +# echo "Payment amount is null; skipping payment." +# fi # Generate application-deployment-request.yml cat >./records/application-deployment-request.yml <