I have the following job, which is based on ./ci/python-publish.yml :
deploy:
runs-on: ubuntu-latest
needs: linux
steps:
- if: github.event_name == 'release' && github.event.action == 'created'
uses: actions/checkout@v1
- if: github.event_name == 'release' && github.event.action == 'created'
name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- if: github.event_name == 'release' && github.event.action == 'created'
name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- if: github.event_name == 'release' && github.event.action == 'created'
name: Build and deploy to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
Instead of repeating if: github.event_name == 'release' && github.event.action == 'created' in each step, I'd like to have it defined for the job. For example:
deploy:
runs-on: ubuntu-latest
needs: linux
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and deploy to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
Or:
deploy:
runs-on: ubuntu-latest
needs: linux
on:
release:
types: [created]
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and deploy to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
However, none of these are accepted. Which is the supported syntax for this use case?
/cc @montudor @Julian @chrispat
I have the following job, which is based on ./ci/python-publish.yml :
Instead of repeating
if: github.event_name == 'release' && github.event.action == 'created'in each step, I'd like to have it defined for the job. For example:Or:
However, none of these are accepted. Which is the supported syntax for this use case?
/cc @montudor @Julian @chrispat