Skip to content

update lock

update lock #66

Workflow file for this run

name: CI/CD Workflow
on:
push:
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
branches:
- main
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout source"
uses: actions/checkout@v4
# for SCM versioning to work
- name: Get history and tags
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"
- name: "Install uv"
uses: astral-sh/setup-uv@v7
with:
version: "0.9.26"
enable-cache: true
- name: "Install dependencies"
run: uv sync --locked --all-extras --dev
- name: "Test package"
run: uv run pytest tests
- name: "Lint package"
run: uv run ruff check --output-format=github .
- name: "Build package"
run: python3 -m build
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: "Publish test results"
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ always() }}
with:
files: |
junit/test-results.xml
# publish-test:
# # if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# needs:
# - build
# runs-on: ubuntu-latest
# environment:
# name: testpypi
# url: https://test.pypi.org/p/vidfetch_bot
# permissions:
# id-token: write
# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: python-package-distributions
# path: dist/
# - name: Publish to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
# verbose: true
publish:
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/vidfetch_bot
permissions:
id-token: write
steps:
- name: "Download artifacts"
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: "Publish to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
docker:
# if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
needs:
- build
- publish
# - publish-test
runs-on: ubuntu-latest
steps:
- name: "Get package metadata"
uses: docker/metadata-action@v5.7.0
id: metadata
with:
images: |
ghcr.io/arthurlt/vidfetch_bot
tags: |
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
flavor: |
latest=auto
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- 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:
build-args: |
PACKAGE_VERSION=${{ steps.metadata.outputs.version }}
platforms: |
linux/amd64
linux/arm64
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
push: true