Skip to content

Merge pull request #4 from Utwo/helm-lint #49

Merge pull request #4 from Utwo/helm-lint

Merge pull request #4 from Utwo/helm-lint #49

Workflow file for this run

name: Build and push
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
push:
branches:
- main
paths:
- backend/**
- frontend/**
- helm/**
- .github/workflows/**
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Install backend dependencies
run: pnpm install --filter ./backend
- name: Check format and lint
run: pnpm run check
- name: Check types
run: pnpm --filter ./backend typecheck
build-push-backend:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'preview') || github.ref_name == github.event.repository.default_branch
needs: check
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/utwo/sandbox-backend
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch,suffix=-{{sha}}
type=sha,prefix=
type=ref,event=pr,suffix=-${{ github.event.pull_request.head.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: backend
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-push-frontend:
runs-on: ubuntu-latest
needs: check
if: contains(github.event.pull_request.labels.*.name, 'preview') || github.ref_name == github.event.repository.default_branch
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/utwo/sandbox-frontend
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch,suffix=-{{sha}}
type=sha,prefix=
type=ref,event=pr,suffix=-${{ github.event.pull_request.head.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: frontend
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ${{ github.event_name == 'pull_request' && format('VITE_API_BACKEND_ARG={0}-{1}.127.0.0.1.nip.io', github.head_ref, github.event.pull_request.number) || 'VITE_API_BACKEND_ARG=127.0.0.1.nip.io' }}