Skip to content

ci: add environment #36

ci: add environment

ci: add environment #36

Workflow file for this run

name: CD frontend
on:
push:
branches:
- main
paths:
- "04_frontend/**"
- ".github/workflows/cd_frontend.yaml"
workflow_dispatch:
jobs:
cd:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./04_frontend
concurrency:
group: 04_frontend-${{ github.ref }}
cancel-in-progress: false
environment:
name: app.gitgazer.com
url: https://app.gitgazer.com/
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./04_frontend/package.json
cache: "npm"
cache-dependency-path: ./04_frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
VITE_HOST_URL: ${{ vars.VITE_HOST_URL }}
VITE_COGNITO_USER_POOL_ID: ${{ vars.VITE_COGNITO_USER_POOL_ID }}
VITE_COGNITO_USER_POOL_CLIENT_ID: ${{ vars.VITE_COGNITO_USER_POOL_CLIENT_ID }}
VITE_COGNITO_DOMAIN: ${{ vars.VITE_COGNITO_DOMAIN }}
VITE_GRAPHQL_ENDPOINT: ${{ vars.VITE_GRAPHQL_ENDPOINT }}
VITE_GRAPHQL_REGION: ${{ vars.VITE_GRAPHQL_REGION }}
VITE_IMPORT_URL_BASE: ${{ vars.VITE_IMPORT_URL_BASE }}
- name: Deploy
run: |
aws s3 sync dist/. s3://${{ vars.FRONTEND_S3_BUCKET_NAME }}/ --cache-control max-age=604800 --exclude "*.html"
aws s3 sync dist/. s3://${{ vars.FRONTEND_S3_BUCKET_NAME }}/ --cache-control max-age=60 --include "*.html"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}