45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
name: Frontend CI/CD
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
linting:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '18'
|
|
- name: Install dependencies
|
|
run: cd frontend && npm install
|
|
- name: Linting
|
|
run: cd frontend && npm run lint
|
|
|
|
build_and_push:
|
|
runs-on: ubuntu-latest
|
|
needs: linting
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '18'
|
|
- name: Install dependencies
|
|
run: cd frontend && npm install
|
|
- name: Build
|
|
run: cd frontend && npm run build
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker build -t skillhub-backend frontend/
|
|
docker push skillhub-backend
|