ci: add GitHub Actions workflow for server CI with linting and Docker build
This commit is contained in:
@@ -0,0 +1,73 @@
|
|||||||
|
name: Server CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ '**' ]
|
||||||
|
paths:
|
||||||
|
- 'CollabTableServer/**'
|
||||||
|
- '.github/workflows/server-ci.yml'
|
||||||
|
pull_request:
|
||||||
|
branches: [ '**' ]
|
||||||
|
paths:
|
||||||
|
- 'CollabTableServer/**'
|
||||||
|
- '.github/workflows/server-ci.yml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: CollabTableServer
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: CollabTableServer/package-lock.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
build-and-push:
|
||||||
|
name: Build & Push Docker Image
|
||||||
|
needs: lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./CollabTableServer
|
||||||
|
push: ${{ github.event_name == 'push' }}
|
||||||
|
tags: |
|
||||||
|
gabriel20xx/CollabTableServer:latest
|
||||||
|
gabriel20xx/CollabTableServer:${{ github.sha }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
Reference in New Issue
Block a user