File: release.yml

package info (click to toggle)
python-adafruit-pureio 1.1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 252 kB
  • sloc: python: 588; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,275 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
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT

name: Release Actions

on:
  release:
    types: [published]

jobs:
  upload-pypi:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Check For pyproject.toml
      id: need-pypi
      run: |
        echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
    - name: Set up Python
      if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
    - name: Install dependencies
      if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
      run: |
        python -m pip install --upgrade pip
        pip install --upgrade build twine
    - name: Build and publish
      if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
      env:
        TWINE_USERNAME: ${{ secrets.pypi_username }}
        TWINE_PASSWORD: ${{ secrets.pypi_password }}
      run: |
        find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
        python -m build
        twine upload dist/*