From 89a14f7731b6afc766cb89ee18753ed0c5a32875 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 6 Nov 2024 09:58:59 +0530 Subject: [PATCH 1/5] Update config for deploying frontend --- packages/deployer/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/deployer/config.yml b/packages/deployer/config.yml index ce7d6b54..730022eb 100644 --- a/packages/deployer/config.yml +++ b/packages/deployer/config.yml @@ -2,7 +2,7 @@ services: registry: rpcEndpoint: https://laconicd-sapo.laconic.com gqlEndpoint: https://laconicd-sapo.laconic.com/api - userKey: - bondId: - chainId: laconic_9000-2 - gasPrice: 1alnt + userKey: + bondId: + chainId: laconic-testnet-2 + gasPrice: 0.001alnt -- 2.45.2 From 9946784b984971d4238b099d6b432e6a06c99bdf Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 6 Nov 2024 10:40:01 +0530 Subject: [PATCH 2/5] Add workflow to deploy snowball frontend --- .gitea/workflows/deploy-frontend.yaml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .gitea/workflows/deploy-frontend.yaml diff --git a/.gitea/workflows/deploy-frontend.yaml b/.gitea/workflows/deploy-frontend.yaml new file mode 100644 index 00000000..40cd5b6d --- /dev/null +++ b/.gitea/workflows/deploy-frontend.yaml @@ -0,0 +1,49 @@ +name: Deploy Snowball frontend + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Download yarn + run: | + curl -fsSL -o /usr/local/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.21/yarn-1.22.21.js + chmod +x /usr/local/bin/yarn + + - name: Set up environment + run: | + # Create a config file with necessary endpoints and placeholders for secrets + cat > packages/deployer/config.yml < Date: Wed, 6 Nov 2024 11:36:02 +0530 Subject: [PATCH 3/5] 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 < Date: Wed, 6 Nov 2024 12:15:55 +0530 Subject: [PATCH 4/5] Update workflow to install dependencies --- .gitea/workflows/deploy-frontend.yaml | 13 +++++++++---- packages/deployer/deploy-frontend.sh | 7 +++++-- packages/deployer/deploy-frontend.vaasl.sh | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy-frontend.yaml b/.gitea/workflows/deploy-frontend.yaml index 7aac3cbf..51e4b9b2 100644 --- a/.gitea/workflows/deploy-frontend.yaml +++ b/.gitea/workflows/deploy-frontend.yaml @@ -26,12 +26,16 @@ jobs: curl -fsSL -o /usr/local/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.21/yarn-1.22.21.js chmod +x /usr/local/bin/yarn + - name: Install dependencies + run: | + yarn install + - 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 + echo "REGISTRY_BOND_ID=${{ secrets.REGISTRY_BOND_ID }}" > packages/deployer/.env + echo "DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" >> packages/deployer/.env + echo "AUTHORITY=laconic-deploy" >> packages/deployer/.env # Create a config file with necessary endpoints and placeholders for secrets cat > packages/deployer/config.yml < Date: Wed, 6 Nov 2024 13:59:48 +0530 Subject: [PATCH 5/5] Update workflow for env setup --- .gitea/workflows/deploy-frontend.yaml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/deploy-frontend.yaml b/.gitea/workflows/deploy-frontend.yaml index 51e4b9b2..1f604639 100644 --- a/.gitea/workflows/deploy-frontend.yaml +++ b/.gitea/workflows/deploy-frontend.yaml @@ -5,6 +5,12 @@ on: branches: - main +env: + REGISTRY_USER_KEY: ${{ secrets.REGISTRY_USER_KEY }} + REGISTRY_BOND_ID: ${{ secrets.REGISTRY_BOND_ID }} + DEPLOYER_LRN: lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io + AUTHORITY: laconic-deploy + jobs: deploy: runs-on: ubuntu-latest @@ -32,24 +38,24 @@ 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 }}" > packages/deployer/.env - echo "DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" >> packages/deployer/.env - echo "AUTHORITY=laconic-deploy" >> packages/deployer/.env + # Create a .env file with the necessary variables + echo "REGISTRY_BOND_ID=$REGISTRY_BOND_ID" > packages/deployer/.env + echo "DEPLOYER_LRN=$DEPLOYER_LRN" >> packages/deployer/.env + echo "AUTHORITY=$AUTHORITY" >> packages/deployer/.env - # Create a config file with necessary endpoints and placeholders for secrets + # Create a config file with necessary endpoints and secrets cat > packages/deployer/config.yml <