Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/cd-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CD - Deploy Frontend

on:
workflow_dispatch:
inputs:
build_number:
description: "Frontend build version to deploy"
required: true

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download artifact from CI workflow
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
echo "Fetching frontend artifact for build #${{ github.event.inputs.build_number }}"
CI_RUN_ID=$(gh run list \
--workflow "CI - Build Frontend" \
--json databaseId,number \
-q ".[] | select(.number == ${{ github.event.inputs.build_number }}) | .databaseId")
if [ -z "$CI_RUN_ID" ]; then
echo "Could not find CI run with build number: ${{ github.event.inputs.build_number }}"
exit 1
fi
echo "Found CI run ID: $CI_RUN_ID"
gh run download $CI_RUN_ID --name frontend-source-${{ github.event.inputs.build_number }}

- name: Extract artifact
run: |
tar -xzf frontend-source-${{ github.event.inputs.build_number }}.tar.gz
ls -la

- name: Setup Node.js & Vercel CLI
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g vercel

- name: Deploy frontend to Vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_FRONTEND }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_FRONTEND }}
run: |
cd frontend # deploy from frontend folder
vercel --prod \
--token=$VERCEL_TOKEN \
--scope=$VERCEL_ORG_ID_FRONTEND \
--confirm
47 changes: 47 additions & 0 deletions .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI - Build Frontend

on:
push:
branches: [main]
paths:
- "shatter-web/**"
- ".github/workflows/ci-frontend.yml"
pull_request:
branches: [main]
paths:
- "shatter-web/**"
- ".github/workflows/ci-frontend.yml"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: |
cd shatter-web
npm ci

- name: Build React app
run: |
cd shatter-web
npm run build

- name: Compress frontend source for artifact
run: |
cd shatter-web
tar -czf ../frontend-source-${{ github.run_number }}.tar.gz .

- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: frontend-source-${{ github.run_number }}
path: frontend-source-${{ github.run_number }}.tar.gz
1 change: 1 addition & 0 deletions shatter-web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dist-ssr
*.sln
*.sw?

.vercel
Loading