2022-08-03 20:57:27 +02:00
|
|
|
name: publish
|
|
|
|
|
|
|
|
on:
|
2022-08-15 05:47:36 +02:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
2022-08-03 20:57:27 +02:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
paths:
|
2022-08-04 02:49:32 +02:00
|
|
|
- src/**
|
|
|
|
- setup.py
|
|
|
|
- .github/workflows/publish.yml
|
2022-08-15 05:47:36 +02:00
|
|
|
pull_request:
|
2022-08-04 02:49:32 +02:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
paths:
|
|
|
|
- src/**
|
2022-08-03 20:57:27 +02:00
|
|
|
- setup.py
|
|
|
|
- .github/workflows/publish.yml
|
|
|
|
|
|
|
|
jobs:
|
2022-08-04 02:49:32 +02:00
|
|
|
publish:
|
2022-08-03 20:57:27 +02:00
|
|
|
name: Publish App to PyPI
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python 3.10
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.10'
|
|
|
|
|
2022-08-03 21:37:16 +02:00
|
|
|
- name: Install Dependencies
|
2022-08-03 20:57:27 +02:00
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2022-08-03 21:01:18 +02:00
|
|
|
pip install build twine
|
2022-08-03 21:37:16 +02:00
|
|
|
|
|
|
|
- name: Install Application
|
|
|
|
run: |
|
2022-08-03 20:57:27 +02:00
|
|
|
pip install --upgrade .
|
|
|
|
|
2022-08-04 03:40:35 +02:00
|
|
|
- name: Publish Release to PyPI
|
2022-08-15 05:47:36 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags')
|
2022-08-04 03:40:35 +02:00
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
|
2022-08-03 20:57:27 +02:00
|
|
|
run: |
|
|
|
|
rm -rf dist
|
|
|
|
python -m build
|
2022-08-03 21:37:16 +02:00
|
|
|
twine check dist/*
|
2022-08-04 03:40:35 +02:00
|
|
|
twine upload dist/*
|
2022-08-03 20:57:27 +02:00
|
|
|
|
2022-08-04 03:40:35 +02:00
|
|
|
- name: Publish Master to PyPI
|
|
|
|
if: github.ref == 'refs/heads/master'
|
2022-08-04 02:18:51 +02:00
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
|
|
|
|
run: |
|
2022-08-04 03:40:35 +02:00
|
|
|
sed -E -i "s/version=(.*)',/version=\1a$(date +%s)',/g" setup.py
|
|
|
|
rm -rf dist
|
|
|
|
python -m build
|
|
|
|
twine check dist/*
|
2022-08-04 02:18:51 +02:00
|
|
|
twine upload dist/*
|
|
|
|
|
2022-08-04 02:49:32 +02:00
|
|
|
- name: Publish PR to Test PyPI
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_KEY }}
|
|
|
|
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
|
|
|
run: |
|
2022-08-04 03:15:16 +02:00
|
|
|
sed -E -i "s/version=(.*)',/version=\1.dev$PULL_REQUEST_NUMBER$(date +%s)',/g" setup.py
|
2022-08-04 02:49:32 +02:00
|
|
|
rm -rf dist
|
|
|
|
python -m build
|
|
|
|
twine check dist/*
|
2022-08-04 03:40:35 +02:00
|
|
|
twine upload -r testpypi dist/*
|