[ci] Update paths-filter GitHub action to v3 #80
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: release | |
on: | |
push: | |
branches: | |
- main | |
- pypi | |
release: | |
types: [released, prereleased] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
release: | |
name: Upload packages to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/hf-deepali | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install requirements | |
run: pip install --upgrade pip build twine wheel | |
- name: Force version for Test PyPI uploads | |
if: ${{ !startsWith(github.ref, 'refs/tags') }} | |
run: | | |
pip install setuptools_scm | |
echo version=$(python -m setuptools_scm | awk -F+ '{print $1}' | tail -1) >> $GITHUB_ENV | |
- name: Build packages | |
run: | | |
python -m build | |
twine check dist/* | |
env: | |
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.version }} | |
- name: Publish packages to Test PyPI | |
if: ${{ github.event_name == 'release' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pypi')) }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Publish packages to PyPI | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 |