Skip to content

[ci] Run limited checks on PR, full tests on merge #63

[ci] Run limited checks on PR, full tests on merge

[ci] Run limited checks on PR, full tests on merge #63

Workflow file for this run

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@v4
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