From 55e83f796f828b3f3541938a64479196fe7f06ed Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 6 Nov 2024 11:36:02 +0530 Subject: [PATCH] Update deploy-frontend script --- .gitea/workflows/deploy-frontend.yaml | 9 +- packages/deployer/deploy-frontend.sh | 4 +- ...nd.staging.sh => deploy-frontend.vaasl.sh} | 91 +++++++++++-------- 3 files changed, 59 insertions(+), 45 deletions(-) rename packages/deployer/{deploy-frontend.staging.sh => deploy-frontend.vaasl.sh} (59%) diff --git a/.gitea/workflows/deploy-frontend.yaml b/.gitea/workflows/deploy-frontend.yaml index 40cd5b6d..7aac3cbf 100644 --- a/.gitea/workflows/deploy-frontend.yaml +++ b/.gitea/workflows/deploy-frontend.yaml @@ -28,6 +28,11 @@ jobs: - name: Set up environment run: | + # Create a .env file with the necessary environment variables from GitHub secrets + echo "REGISTRY_BOND_ID=${{ secrets.REGISTRY_BOND_ID }}" > .env + echo "DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" >> .env + echo "AUTHORITY=laconic-deploy" >> .env + # Create a config file with necessary endpoints and placeholders for secrets cat > packages/deployer/config.yml </dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}') +NEW_APPLICATION_VERSION=$(yarn --silent laconic -c $CONFIG_FILE registry record list --type ApplicationRecord --all --name "deploy-frontend" 2>/dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}') if [ -z "$NEW_APPLICATION_VERSION" ] || [ "1" == "$NEW_APPLICATION_VERSION" ]; then # Set application-record version if no previous records were found NEW_APPLICATION_VERSION=0.0.1 fi -# Generate application-deployment-request.yml -cat >./staging-records/application-deployment-request.yml <./staging-records/application-record.yml <./records/application-record.yml <./records/application-deployment-request.yml <