Skip to content

Merge pull request #28 from zbw/26-upgrade-gunicorn-and-citation #12

Merge pull request #28 from zbw/26-upgrade-gunicorn-and-citation

Merge pull request #28 from zbw/26-upgrade-gunicorn-and-citation #12

Workflow file for this run

name: Publish Release
on:
push:
tags:
- "*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'poetry'
- name: Install dependencies
run: poetry install --no-root
- name: Test Code
run: poetry run pytest
publish-pypi:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Build and upload to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ $(poetry version -s) != ${{ github.ref_name }} ]; then
echo "The version specified in pyproject.toml and the tag name are not the same"
echo "Will use the tag name as version name"
poetry version ${{ github.ref_name }}
fi
poetry publish --build
publish-docker:
runs-on: ubuntu-latest
needs: [test]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}