Skip to content

fix(deps): update all non-major dependencies #413

fix(deps): update all non-major dependencies

fix(deps): update all non-major dependencies #413

Workflow file for this run

name: Backend CI/CD
on:
push:
branches:
- main
- feat/**
paths:
- 'apps/backend/**'
- 'packages/**'
- '.dockerignore'
- '.github/workflows/backend.yml'
pull_request:
branches:
- main
paths:
- 'apps/backend/**'
- 'packages/**'
- '.dockerignore'
workflow_dispatch:
concurrency:
group: backend-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-build:
runs-on: ubuntu-latest
name: Lint and Build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Cache Turbo
uses: actions/cache@v4
with:
path: .turbo/cache
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint backend
run: pnpm --filter @gekichumai/backend lint
- name: Build backend
run: pnpm turbo run build --filter=@gekichumai/backend
integration-test:
runs-on: ubuntu-latest
name: Integration Tests
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dxrating_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run integration tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/dxrating_test
BETTER_AUTH_SECRET: ci_test_secret_1234567890
BETTER_AUTH_URL: http://localhost:3001
NODE_ENV: test
PORT: 3001
run: pnpm --filter @gekichumai/backend test
docker-build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: Build Docker Image
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute build metadata
id: build-meta
run: |
echo "built_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "version=${LATEST_TAG}" >> "$GITHUB_OUTPUT"
echo "source_date_epoch=$(date +%s)" >> "$GITHUB_OUTPUT"
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/backend
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
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.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/backend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
GIT_COMMIT=${{ github.sha }}
BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
REPO_URL=${{ github.server_url }}/${{ github.repository }}
BUILT_AT=${{ steps.build-meta.outputs.built_at }}
VERSION=${{ steps.build-meta.outputs.version }}
SOURCE_DATE_EPOCH=${{ steps.build-meta.outputs.source_date_epoch }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/backend:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:buildcache,mode=max,compression=zstd
platforms: linux/amd64
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-name: ghcr.io/${{ github.repository }}/backend
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
deploy:
runs-on: ubuntu-latest
needs: [lint-and-build, integration-test, docker-build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: Deploy to Coolify
steps:
- name: Trigger Coolify deployment
run: |
curl --request GET "${{ secrets.COOLIFY_WEBHOOK_URL }}" \
--header "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" \
--header "CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}" \
--header "CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}" \
--fail --silent --show-error