Skip to content

fixes

fixes #140

name: Deploy
on:
push:
branches: [ 'main' ]
tags:
- 'v*'
jobs:
migrate_test:
name: Migrate Test DB
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
environment:
name: Testing
env:
ENVIRONMENT: 'testing'
DB_DSN: ${{ secrets.DB_DSN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m ensurepip
pip install -r requirements.txt -r requirements.dev.txt
- name: Migrate DB
run: |
alembic upgrade head
migrate_prod:
name: Migrate Production DB
runs-on: ubuntu-latest
needs: migrate_test
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
packages: write
environment:
name: Production
env:
ENVIRONMENT: 'production'
DB_DSN: ${{ secrets.DB_DSN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m ensurepip
pip install -r requirements.txt -r requirements.dev.txt
pip install build --user
python -m build --wheel --sdist --outdir dist/
- name: Migrate DB
run: |
alembic upgrade head
build-and-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
needs: migrate_prod
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: Production
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Change version
run: |
VERSION=${{ github.ref_name }}
sed -i -e "s/__version__ = '1.0.0'/__version__ = '${VERSION:1}'/g" ${{ github.workspace }}/profcomff_definitions/__init__.py
- name: Install dependencies
run: |
python -m ensurepip
pip install build --user
python -m build --wheel --sdist --outdir dist/
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true