Add a CI workflow to deploy frontend #35

Merged
prathamesh merged 5 commits from deep-stack/snowballtools-base:ag-frontend-ci into main 2024-11-06 09:20:02 +00:00
3 changed files with 15 additions and 6 deletions
Showing only changes of commit cc22861890 - Show all commits

View File

@ -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 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 chmod +x /usr/local/bin/yarn
- name: Install dependencies
run: |
yarn install
- 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 +51,5 @@ jobs:
- name: Run Deploy Script - name: Run Deploy Script
run: | run: |
packages/deployer/deploy-frontend.sh cd packages/deployer
./deploy-frontend.sh

View File

@ -102,6 +102,9 @@ 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")
@ -122,7 +125,7 @@ record:
name: deploy-frontend@$PACKAGE_VERSION name: deploy-frontend@$PACKAGE_VERSION
application: lrn://$AUTHORITY/applications/deploy-frontend@$PACKAGE_VERSION application: lrn://$AUTHORITY/applications/deploy-frontend@$PACKAGE_VERSION
deployer: $DEPLOYER_LRN deployer: $DEPLOYER_LRN
dns: deploy dns: deploy.laconic.com
config: config:
env: env:
LACONIC_HOSTED_CONFIG_server_url: https://deploy-backend.laconic.com LACONIC_HOSTED_CONFIG_server_url: https://deploy-backend.laconic.com
@ -133,7 +136,7 @@ record:
LACONIC_HOSTED_CONFIG_wallet_connect_id: 63cad7ba97391f63652161f484670e15 LACONIC_HOSTED_CONFIG_wallet_connect_id: 63cad7ba97391f63652161f484670e15
LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2 LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2
meta: meta:
note: Added by Snowball @ $CURRENT_DATE_TIME note: Added @ $CURRENT_DATE_TIME
repository: "$REPO_URL" repository: "$REPO_URL"
repository_ref: $LATEST_HASH repository_ref: $LATEST_HASH
payment: $txHash payment: $txHash

View File

@ -126,6 +126,7 @@ record:
LACONIC_HOSTED_CONFIG_github_clientid: Ov23liaet4yc0KX0iM1c LACONIC_HOSTED_CONFIG_github_clientid: Ov23liaet4yc0KX0iM1c
LACONIC_HOSTED_CONFIG_github_pwa_templaterepo: laconic-templates/test-progressive-web-app LACONIC_HOSTED_CONFIG_github_pwa_templaterepo: laconic-templates/test-progressive-web-app
LACONIC_HOSTED_CONFIG_github_image_upload_templaterepo: laconic-templates/image-upload-pwa-example LACONIC_HOSTED_CONFIG_github_image_upload_templaterepo: laconic-templates/image-upload-pwa-example
LACONIC_HOSTED_CONFIG_github_next_app_templaterepo: laconic-templates/starter.nextjs-react-tailwind
LACONIC_HOSTED_CONFIG_wallet_connect_id: 63cad7ba97391f63652161f484670e15 LACONIC_HOSTED_CONFIG_wallet_connect_id: 63cad7ba97391f63652161f484670e15
LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2 LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2
meta: meta: