Skip to content

Update dependency husky to v9.1.2 #1076

Update dependency husky to v9.1.2

Update dependency husky to v9.1.2 #1076

Workflow file for this run

name: CI/CD
on:
workflow_dispatch:
push:
jobs:
build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache-dependency-path: "frontend/package-lock.json"
- run: npm ci
- run: npm run format-ci
- run: npm test
- run: npm run build
build-backend:
name: Build Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Poetry
uses: abatilo/[email protected]
- run: poetry install
- run: poetry run pytest -m "not slow" -r fsx
build-images:
name: Build Container Images
needs: [ build-frontend, build-backend ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
strategy:
fail-fast: true
matrix:
component: [frontend, backend]
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: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-${{ matrix.component }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set release version
id: version
shell: bash
run: |
git fetch --prune --unshallow
echo "::set-output name=release::$(git describe --tags --dirty)"
- name: Build ${{ matrix.component }} image
uses: docker/build-push-action@v6
with:
push: true
context: ${{ matrix.component }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
build-args: RELEASE=${{ steps.version.outputs.release }}
deploy:
name: Deploy
needs: [ build-images ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
environment:
name: production
url: https://snatch.flipdot.org
steps:
- uses: actions/checkout@v4
- name: Setup SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add host fingerprint to known_hosts
run: echo "${{ vars.SSH_HOST_FINGERPRINT }}" >> ~/.ssh/known_hosts
- name: Copy compose.yaml to host
run: scp -r compose.yaml infrastructure ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}:~/snatch/
- name: Reload docker compose
run: ssh ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }} 'cd ~/snatch && docker compose pull && docker compose up -d'
- name: Cleanup disk space
run: ssh ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }} 'docker system prune -fa'