chore: use uv #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
RUNS_ON: ubuntu-24.04 | |
jobs: | |
ruff-format: | |
name: Ruff / Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install dependencies | |
run: uv sync --dev | |
- name: Check formatting | |
run: uv run ruff format --check . | |
ruff-lint: | |
name: Ruff / Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install dependencies | |
run: uv sync --dev | |
- name: Run linting | |
run: uv run ruff check . | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
tags: virtool/create-sample:test | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
release: | |
needs: [build] | |
name: Publish / Release | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
outputs: | |
git-tag: ${{ steps.semantic.outputs.git-tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Install semantic-release | |
run: npm i [email protected] @semantic-release/[email protected] [email protected] | |
- name: Run semantic-release | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release | |
ghcr: | |
name: Publish / GHCR | |
runs-on: ubuntu-latest | |
if: | | |
github.repository_owner == 'Virtool' && | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/main' && | |
needs.release.outputs.git-tag != '' | |
needs: [release] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.release.outputs.git-tag }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Write VERSION file | |
run: echo ${{ needs.release.outputs.git-tag }} > VERSION | |
- name: Update Version | |
run: uv version ${{ needs.release.outputs.git-tag }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
context: git | |
images: ${{ env.REGISTRY }}/virtool/create-sample | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |