diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16bc74e95..f4fef3a8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: - name: Build frontend run: | cd nuxt-frontend - yarn install --frozen-lockfile + yarn install npx prettier -c . npx eslint . yarn build diff --git a/.github/workflows/deploy-frontend-dev.yml b/.github/workflows/deploy-frontend-dev.yml index 93d8bd434..9b725d65d 100644 --- a/.github/workflows/deploy-frontend-dev.yml +++ b/.github/workflows/deploy-frontend-dev.yml @@ -1,19 +1,10 @@ -name: DeployFrontendServerlessDev +name: DeployFrontendCloudflarePagesDev -on: - workflow_run: - workflows: ["DeployBackendDev"] - types: - - completed - branches: - - "master" +on: push jobs: deploy-frontend-dev: runs-on: ubuntu-latest - permissions: - id-token: write - contents: read steps: - name: Checkout uses: actions/checkout@v2.3.3 @@ -22,33 +13,19 @@ jobs: with: node-version: "20" - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-frontend-access - aws-region: ap-south-1 - - - name: Build frontend and copy zip to S3 + - name: Install dependencies and Build the project run: | cd nuxt-frontend sed -i "s|VITE_RECAPTCHA_SITE_KEY_VALUE|${{ secrets.RECAPTCHA_SITE_KEY }}|g" config.js sed -i "s|RESOURCES_URL|${{ secrets.RESOURCES_URL }}|g" config.js sed -i "s|CLOUDFRONT_URL_VALUE|${{ secrets.CLOUDFRONT_URL_VALUE_DEV }}|g" config.js - yarn install --frozen-lockfile && yarn build - cd .output/server && zip canopas_website_SSR_dev_${{ github.sha }}-${{ github.run_attempt }}.zip -r . && aws s3 cp canopas_website_SSR_dev_${{ github.sha }}-${{ github.run_attempt }}.zip s3://canopas-lambda-handlers && cd ../.. - aws s3 rm s3://canopas-website-ssr-dev --recursive - aws s3 sync --cache-control 'max-age=604800' --exclude *.html ./.output/public s3://canopas-website-ssr-dev - aws s3 sync ./.output/public s3://canopas-website-ssr-dev - - - name: Deploy cloudformation stack - id: canopas-website-dev-lambda-stack-frontend - uses: aws-actions/aws-cloudformation-github-deploy@v1 + yarn install && yarn build + ls -l dist + + - name: Build & Deploy Worker + uses: cloudflare/wrangler-action@v3 with: - name: canopas-website-dev-lambda-stack-frontend - template: infrastructure/frontend.yml - capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM, CAPABILITY_AUTO_EXPAND - timeout-in-minutes: "10" - no-fail-on-empty-changeset: "1" - parameter-overrides: >- - EnvName=dev, - ZipFileName=canopas_website_SSR_dev_${{ github.sha }}-${{ github.run_attempt }}.zip + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + workingDirectory: "nuxt-frontend" + command: pages deploy ./dist --project-name=canopas-website-dev --branch=main diff --git a/.github/workflows/deploy-frontend-prod.yml b/.github/workflows/deploy-frontend-prod.yml index c1495a21c..0882cd275 100644 --- a/.github/workflows/deploy-frontend-prod.yml +++ b/.github/workflows/deploy-frontend-prod.yml @@ -1,19 +1,10 @@ -name: DeployFrontendServerlessProd +name: DeployFrontendCloudflarePagesProd -on: - workflow_run: - workflows: ["DeployBackendProd"] - types: - - completed - branches: - - "master" +on: push jobs: deploy-frontend-prod: runs-on: ubuntu-latest - permissions: - id-token: write - contents: read steps: - name: Checkout uses: actions/checkout@v2.3.3 @@ -22,34 +13,20 @@ jobs: with: node-version: "20" - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-frontend-access - aws-region: ap-south-1 - - - name: Build frontend and copy zip to S3 + - name: Install dependencies and Build the project run: | cd nuxt-frontend sed -i "s|VITE_RECAPTCHA_SITE_KEY_VALUE|${{ secrets.RECAPTCHA_SITE_KEY }}|g" config.prod.js sed -i "s|RESOURCES_URL|${{ secrets.RESOURCES_URL }}|g" config.prod.js - sed -i "s|CLOUDFRONT_URL_VALUE|${{ secrets.CLOUDFRONT_URL_VALUE_PROD }}|g" config.prod.js + sed -i "s|CLOUDFRONT_URL_VALUE|${{ secrets.CLOUDFRONT_URL_VALUE_DEV }}|g" config.prod.js mv config.prod.js config.js - yarn install --frozen-lockfile && yarn build - cd .output/server && zip canopas_website_SSR_prod_${{ github.sha }}-${{ github.run_attempt }}.zip -r . && aws s3 cp canopas_website_SSR_prod_${{ github.sha }}-${{ github.run_attempt }}.zip s3://canopas-lambda-handlers && cd ../.. - aws s3 rm s3://canopas-website-ssr-dev --recursive - aws s3 sync --cache-control 'max-age=604800' --exclude *.html ./.output/public s3://canopas-website-ssr-prod - aws s3 sync ./.output/public s3://canopas-website-ssr-prod - - - name: Deploy cloudformation stack - id: canopas-website-prod-lambda-stack-frontend - uses: aws-actions/aws-cloudformation-github-deploy@v1 + yarn install && yarn build + ls -l dist + + - name: Build & Deploy Worker + uses: cloudflare/wrangler-action@v3 with: - name: canopas-website-prod-lambda-stack-frontend - template: infrastructure/frontend.yml - capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM, CAPABILITY_AUTO_EXPAND - timeout-in-minutes: "10" - no-fail-on-empty-changeset: "1" - parameter-overrides: >- - EnvName=prod, - ZipFileName=canopas_website_SSR_prod_${{ github.sha }}-${{ github.run_attempt }}.zip + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + workingDirectory: "nuxt-frontend" + command: pages deploy ./dist --project-name=canopas-website --branch=main diff --git a/.gitignore b/.gitignore index bded6116b..fbbaad1cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store .env base64 +.yarn diff --git a/nuxt-frontend/.gitignore b/nuxt-frontend/.gitignore index 4a7f73a2e..d76d0e9d8 100644 --- a/nuxt-frontend/.gitignore +++ b/nuxt-frontend/.gitignore @@ -4,6 +4,7 @@ .nuxt .nitro .cache +.wrangler dist # Node dependencies diff --git a/nuxt-frontend/assets/css/global.css b/nuxt-frontend/assets/css/tailwind.css similarity index 100% rename from nuxt-frontend/assets/css/global.css rename to nuxt-frontend/assets/css/tailwind.css diff --git a/nuxt-frontend/components/contributions/DesktopLanding.vue b/nuxt-frontend/components/contributions/DesktopLanding.vue index 6a38663ef..c99492713 100644 --- a/nuxt-frontend/components/contributions/DesktopLanding.vue +++ b/nuxt-frontend/components/contributions/DesktopLanding.vue @@ -85,7 +85,7 @@