Skip to content

fix: replace error cards with toast notifications and auto-reporting #39

fix: replace error cards with toast notifications and auto-reporting

fix: replace error cards with toast notifications and auto-reporting #39

Workflow file for this run

name: Server CI/CD
on:
pull_request:
paths-ignore:
- "client/**"
- "deploy/client/**"
- ".github/workflows/client-ci-cd.yml"
push:
branches:
- main
paths-ignore:
- "client/**"
- "deploy/client/**"
- ".github/workflows/client-ci-cd.yml"
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
lint:
name: Lint Server
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
outputs:
python-version: ${{ steps.setup-python.outputs.python-version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
working-directory: server
- name: Set up Python
id: setup-python
run: |
uv python install
echo "python-version=$(uv python pin)" >> $GITHUB_OUTPUT
- name: Sync dependencies
run: uv sync --locked --extra ci
- name: Ruff
run: |
uv run ruff check --output-format=github
uv run ruff format --check
- name: Ty
run: uv run ty check .
release:
if: ${{ github.ref == 'refs/heads/main' }}
name: Release
needs: lint
runs-on: ubuntu-latest
concurrency:
group: release-server-${{ github.ref_name }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
timeout-minutes: 10
defaults:
run:
working-directory: server
outputs:
version: ${{ steps.semantic-release.outputs.version }}
released: ${{ steps.semantic-release.outputs.released }}
steps:
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
token: ${{ steps.app-token.outputs.token }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
working-directory: server
- name: Set up Python
run: uv python install
- name: Install dependencies
run: uv sync --locked --extra ci
- name: Prestamp Release
id: semantic-release
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
commit: false
tag: false
push: false
vcs_release: false
changelog: false
build: false
github_token: ${{ steps.app-token.outputs.token }}
directory: server
- name: Python Semantic Release
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
uv lock --upgrade-package request_server
git add uv.lock
uv run semantic-release -v version
build_push:
if: ${{ startsWith(github.ref, 'refs/heads/') }}
name: Build & Push
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 15
outputs:
digest: ${{ steps.build-push.outputs.digest }}
tags: ${{ steps.meta.outputs.tags }}
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/request-server
tags: |
type=semver,pattern={{version}},value=${{ needs.release.outputs.version }},enable=${{ needs.release.outputs.version != '' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && needs.release.outputs.released == 'true' }}
type=sha
- name: Build and push Docker image
id: build-push
uses: docker/build-push-action@v6
with:
context: .
file: deploy/server/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max