ci: add comments for vercel-deploy-preview (#21349)

**/build-deploy-preview env=release**

![Screenshot 2023-03-14 at 9 49 44
AM](https://user-images.githubusercontent.com/15846947/224892349-588b3460-0b8d-4937-9b94-4013d03275a0.png)

---------

Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
This commit is contained in:
Goutham Pratapa 2023-03-16 17:32:32 +05:30 committed by GitHub
parent 424d2f6965
commit 47750db727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

@ -22,8 +22,8 @@ jobs:
PR: ${{ github.event.client_payload.pull_request.number }}.
server-build:
if: github.event.client_payload.slash_command.args.named.env != 'release'
name: server-build
if: github.event.client_payload.slash_command.args.named.env != 'release'
uses: ./.github/workflows/server-build.yml
secrets: inherit
with:
@ -48,8 +48,8 @@ jobs:
pr: ${{ github.event.client_payload.pull_request.number }}
vercel-build:
name: vercel-build
if: github.event.client_payload.slash_command.args.named.env == 'release'
name: vercel-local-build
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
@ -79,12 +79,23 @@ jobs:
run: vercel build --yes --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
id: set-dpurl
run: |
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} >> ~/run_result.txt
echo "::set-output name=dpurl::$(cat ~/run_result.txt)"
- name: vercel-notify
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
Deploy-Preview-URL: ${{ steps.set-dpurl.outputs.dpurl }}
push-image:
needs: [client-build, rts-build, server-build]
runs-on: ubuntu-latest
if: success() && github.event.client_payload.slash_command.args.named.env != 'release'
if: success()
steps:
- name: Set up Depot CLI
@ -145,7 +156,7 @@ jobs:
run:
working-directory: "."
if: success() && github.event.client_payload.slash_command.args.named.env != 'release'
if: success()
steps:
- name: Checkout PR
@ -174,6 +185,9 @@ jobs:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
PULL_REQUEST_NUMBER: ${{ github.event.client_payload.pull_request.number }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_URL: ${{ secrets.DB_URL }}
run: |
echo "environment variables set to deploy the image" $IMAGE_HASH
/bin/bash ./scripts/deploy_preview.sh

View File

@ -31,6 +31,7 @@ export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken
export NAMESPACE=ce"$PULL_REQUEST_NUMBER"
export CHARTNAME=ce"$PULL_REQUEST_NUMBER"
export SECRET=ce"$PULL_REQUEST_NUMBER"
export DBNAME=ce"$PULL_REQUEST_NUMBER"
export DOMAINNAME=ce-"$PULL_REQUEST_NUMBER".dp.appsmith.com
export HELMCHART="appsmith"
export HELMCHART_URL="http://helm.appsmith.com"
@ -64,4 +65,5 @@ helm upgrade -i $CHARTNAME appsmith/appsmith -n $NAMESPACE \
--set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \
--set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \
--set ingress.className="nginx" --set image.pullPolicy="Always" --set autoupdate.enabled="true" --set persistence.size=4Gi \
--set applicationConfig.APPSMITH_MONGODB_URI="mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" \
--version $HELMCHART_VERSION