try pull_request_comment #118
Workflow file for this run
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: Python CD | ||
on: | ||
release: | ||
types: [ published ] | ||
pull_request_comment: | ||
jobs: | ||
publish-pypi-package: | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Verify the tag version in the pyproject.toml | ||
run: grep -q "version = \"${{ github.event.release.tag_name }}\"" pyproject.toml || exit 1 | ||
shell: bash | ||
- uses: ./.github/actions/python_prepare | ||
- name: Build and Publish | ||
run: poetry publish -p ${{ secrets.PYPI_TOKEN }} -u "__token__" --build | ||
shell: bash | ||
publish-dev-package: | ||
if: github.event.issue.pull_request != null && github.event_name == 'pull_request_comment' && contains(github.event.comment.body, 'deploy please') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: ./.github/actions/python_prepare | ||
- name: Set Development Version | ||
run: | | ||
current_version=$(poetry version -s) | ||
poetry version "${current_version}.dev${{ github.run_number }}" | ||
shell: bash | ||
- name: Build and Publish Development Package | ||
run: poetry publish -p ${{ secrets.PYPI_TOKEN }} -u "__token__" --build | ||
shell: bash |