Skip to content

feat: Deployment (#16) #11

feat: Deployment (#16)

feat: Deployment (#16) #11

Workflow file for this run

name: frontend
on:
workflow_dispatch:
push:
paths:
- 'packages/frontend/**'
branches:
- main
tags:
- "v*.*.*"
pull_request:
paths:
- 'packages/frontend/**'
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
name: Check for Linting Errors
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 22
- name: NPM Install
run: npm install --only=dev
shell: bash
- name: Check for Formatting Issues
run: npm run format
- name: Check for Linting Issues
run: npm run lint
build:
runs-on: ubuntu-latest
name: Build Code
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 22
- name: NPM Install
run: npm install
shell: bash
- name: Build
run: npm run build
docker:
name: Docker Build and Push
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/frontend
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker Tags
id: meta
uses: docker/metadata-action@v4
with:
images: |
hicsail/comets-frontend
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push Docker Build
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
context: ./packages/frontend
file: ./packages/frontend/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=gateway
cache-to: type=gha,mode=max,scope=gateway
build-args: |
VITE_COMETS_BACKEND=${{ secrets.BACKEND_URL }}