BOT: pre-commit hooks autoupdate #1331
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 | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install Dependencies | |
run: python -m pip install --upgrade build twine | |
- name: Build sdist | |
run: make dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: release | |
path: dist/ | |
publish-to-TestPyPI: | |
needs: sdist | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release | |
path: dist/ | |
- name: List dist/ Folder | |
run: ls dist/ -l | |
- name: Publish to TestPyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
verbose: true | |
publish-to-PyPI: | |
needs: sdist | |
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/v') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release | |
path: dist/ | |
- name: List dist/ Folder | |
run: ls dist/ -l | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
publish-to-GitHub: | |
needs: sdist | |
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/v') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release | |
path: dist/ | |
- name: List dist/ Folder | |
run: ls dist/ -l | |
- name: Get Asset name | |
run: | | |
export PKG=$(ls dist/ | grep tar) | |
set -- $PKG | |
echo "name=$1" >> $GITHUB_ENV | |
- name: Publish to GitHub | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
prerelease: ${{ contains(github.ref, 'rc') }} | |
files: dist/${{ env.name }} |