Skip to content

build(cms): Fix build of CMS by downgrade Cloud Storage plugin #666

build(cms): Fix build of CMS by downgrade Cloud Storage plugin

build(cms): Fix build of CMS by downgrade Cloud Storage plugin #666

Workflow file for this run

name: CI
on:
push:
branches: ["main", "production"]
pull_request:
types: [opened, synchronize]
workflow_dispatch:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # remote caching
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} # remote caching
jobs:
build:
name: Lint, Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Grab cache
uses: actions/cache/restore@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
CI-${{ runner.os }}-${{ github.ref }}-
CI-${{ runner.os }}-refs/head/main-
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
- name: Run Prettier
id: prettier-run
uses: rutajdash/[email protected]
with:
config_path: ./.prettierrc
# This step only runs if prettier finds errors causing the previous step to fail
# This steps lists the files where errors were found
- name: Prettier Output
if: ${{ failure() }}
shell: bash
run: |
echo "❌ The following files are not formatted:"
echo "${{steps.prettier-run.outputs.prettier_output}}"
echo "⭐️ You should run `yarn format` in the root of the project directory to fix these files"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CI }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CI }}
aws-region: ap-southeast-1
- name: Lint + Build + Unit Test
run: yarn turbo run lint build:ci --color
env:
#merch
AWS_REGION: 'ap-southeast-1'
PRODUCT_TABLE_NAME: 'be-dev-products'
ORDER_TABLE_NAME: 'be-dev-orders'
ORDER_HOLD_TABLE_NAME: 'be-dev-orders-hold'
# web
WORDPRESS_API_URL: 'https://clubs.ntu.edu.sg/csec/graphql'
NEXT_PUBLIC_MERCH_API_ORIGIN: 'http://127.0.0.1:3002'
- name: Cache CI workflow for dependent jobs
uses: actions/cache/save@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
preview:
name: Vercel Preview - web
timeout-minutes: 15
runs-on: ubuntu-latest
needs: build
permissions:
deployments: write
pull-requests: write
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_WEB }}
steps:
- name: Create GitHub deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: '${{ github.token }}'
environment: Preview - website
- name: Set Github Deployment status to pending
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'pending'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Get build cache
uses: actions/cache/restore@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Copy Build Artifacts to .vercel dir
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
id: deploy-to-vercel
run: |
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "deployment-url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"
- name: Print Deployment URL
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
run: echo $DEPLOYMENT_URL
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-to-vercel.outputs.deployment-url }}'
state: 'success'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'failure'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Comment PR with preview link if success
if: success() && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
with:
message: |
Deployment preview link: ${{ env.DEPLOYMENT_URL }}
comment_tag: execution
mode: recreate
- name: Comment PR with preview link if fail
if: failure() && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
with:
message: |
Deployment preview link: ❌
comment_tag: execution
mode: recreate