Skip to content

feat(frontend): Scroll restoration #36

feat(frontend): Scroll restoration

feat(frontend): Scroll restoration #36

Workflow file for this run

name: Workflow
on: [push]
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-2
jobs:
ci:
name: CI
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
run_install: |
- recursive: true
- cwd: ./frontend
- name: Lint frontend
run: pnpm lint
working-directory: ./frontend
- name: Format frontend
run: pnpm format
working-directory: ./frontend
- name: Write frontend environment variables
run: echo "VITE_API_BASE_URL=${{ vars.VITE_API_BASE_URL }}" | cat >> .env
working-directory: ./frontend
- name: Test frontend
run: pnpm test
working-directory: ./frontend
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.1"
- name: Test restaurants lambda
run: go test -v -json restaurants
working-directory: ./backend/lambdas/restaurants
- name: Test flavors lambda
run: go test -v -json flavors
working-directory: ./backend/lambdas/flavors
- name: Test restaurant lambda
run: go test -v -json restaurant
working-directory: ./backend/lambdas/restaurant
- name: Test flavor lambda
run: go test -v -json flavor
working-directory: ./backend/lambdas/flavor
cd:
name: CD
runs-on: ubuntu-22.04
needs: [ci]
env:
TF_VAR_domain: ${{ vars.DOMAIN }}
TF_VAR_cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TF_VAR_cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.1"
- name: Build restaurants lambda
run: ./build.sh
working-directory: ./backend/lambdas/restaurants
- name: Build flavors lambda
run: ./build.sh
working-directory: ./backend/lambdas/flavors
- name: Build restaurant lambda
run: ./build.sh
working-directory: ./backend/lambdas/restaurant
- name: Build flavor lambda
run: ./build.sh
working-directory: ./backend/lambdas/flavor
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
run_install: |
- recursive: true
- cwd: ./frontend
- name: Write frontend environment variables
run: echo "VITE_API_BASE_URL=${{ vars.VITE_API_BASE_URL }}" | cat >> .env
working-directory: ./frontend
- name: Build frontend
run: pnpm build
working-directory: ./frontend
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Init
run: terraform init
working-directory: ./terraform
- name: Terraform Validate
run: terraform validate
working-directory: ./terraform
- name: Terraform Format
run: terraform fmt -check
working-directory: ./terraform
- name: Terraform Plan
run: terraform plan -input=false
working-directory: ./terraform
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false
working-directory: ./terraform
- name: Download AWS CLI
if: ${{ env.ACT }}
run: curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- name: Unzip AWS CLI
if: ${{ env.ACT }}
run: unzip -q awscliv2.zip
- name: Install AWS CLI
if: ${{ env.ACT }}
run: ./aws/install
- name: AWS CLI version
run: aws --version
- name: AWS CLI Configure
run: |
aws configure set aws_access_key_id $(echo $AWS_ACCESS_KEY)
aws configure set aws_secret_access_key $(echo $AWS_SECRET_ACCESS_KEY)
aws configure set region $(echo $AWS_REGION)
- name: Sync frontend with S3
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: aws s3 sync dist/ s3://fodder.${{ vars.DOMAIN }}/ --delete
working-directory: ./frontend
- name: Invalidate frontend on CloudFront
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.FODDER_DISTRIBUTION_ID }} --paths "/**/*"
env:
AWS_PAGER: ""