Continuous Deployment #13
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: Continuous Deployment | |
# on: | |
# workflow_dispatch: | |
on: | |
workflow_run: | |
workflows: | |
- Continuous Integration | |
types: | |
- completed | |
jobs: | |
release_new_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' # Set the Python version you need | |
# - name: Install make | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y make | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "export PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
source $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Extract project version | |
run: | | |
VERSION=$(poetry run python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
# - name: Build Documentation | |
# run: | | |
# make -C documentation clean | |
# make -C documentation html | |
# - name: Create new github tags | |
# run: | | |
# git tag -m "Version v${{ env.VERSION }}" "v${{ env.VERSION }}" | |
# git push --tags | |
- name: Publish new version on PyPI | |
run: | | |
poetry build | |
poetry publish --username __token__ --password ${{ secrets.ADMIN_PYPI_TOKEN }} | |
- name: Notify Deployment | |
run: echo "Version ${{ env.VERSION }} as been published on PyPI with release ${{ github.ref }}" |