File: pypi-publish.yml

package info (click to toggle)
python-cmaes 0.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 544 kB
  • sloc: python: 5,136; sh: 92; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish distributions to TestPyPI and PyPI

on:
  push:
    tags:
    - v*.*.*

jobs:
  build-n-publish:
    name: Build and publish Python distributions to TestPyPI and PyPI
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.x'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip setuptools
        pip install --progress-bar off twine wheel build
    - name: Build distribution packages
      run: python -m build --sdist --wheel
    - name: Verify the distributions
      run: twine check dist/*

    - uses: actions/upload-artifact@v4
      with:
        name: distribution
        path: dist/

    - name: Publish distribution to Test PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        user: __token__
        password: ${{ secrets.TEST_PYPI_PASSWORD }}
        repository_url: https://test.pypi.org/legacy/

    - name: Publish distribution to PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        user: __token__
        password: ${{ secrets.PYPI_PASSWORD }}

    - name: Create GitHub release
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH" | sed -e "s/refs\/tags\///")
        gh release create ${TAGNAME} --draft dist/*