improve subpath configuration #52
This file contains 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: Build Package | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "**" | |
workflow_dispatch: | |
pull_request: | |
permissions: | |
packages: write | |
contents: write | |
id-token: write | |
jobs: | |
test: | |
name: pytest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
- name: Set up Python | |
run: uv python install | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run tests | |
run: uv run pytest | |
build_docker: | |
name: build docker | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: set build env | |
run: | | |
echo "GHCR_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | |
- name: Build and push image | |
uses: docker/build-push-action@v6 | |
with: | |
file: Containerfile | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ env.GHCR_OWNER }}/taranis-scheduler:latest | |
ghcr.io/${{ env.GHCR_OWNER }}/taranis-scheduler:${{ github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build_wheel: | |
name: build wheel | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
- name: build | |
run: uv build | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dist/taranis_scheduler-*.whl | |
dist/taranis_scheduler-*.tar.gz | |
- name: Release to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |