]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blob - .github/workflows/release.yml
f1ceab6740c3054fa6b946574f4c52bfc7934be5
[hackapet/Adafruit_Blinka_Displayio.git] / .github / workflows / release.yml
1 # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2 # SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
3 #
4 # SPDX-License-Identifier: MIT
5
6 name: Release Actions
7
8 on:
9   release:
10     types: [published]
11
12 jobs:
13   upload-pypi:
14     runs-on: ubuntu-latest
15     steps:
16     - uses: actions/checkout@v3
17     - name: Check For pyproject.toml
18       id: need-pypi
19       run: |
20         echo "pyproject-toml=$( find . -wholename './pyproject.toml' )" >> $GITHUB_OUTPUT
21     - name: Set up Python
22       if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
23       uses: actions/setup-python@v4
24       with:
25         python-version: '3.7'
26     - name: Install dependencies
27       if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
28       run: |
29         python -m pip install --upgrade pip
30         pip install --upgrade build twine
31     - name: Build and publish
32       if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
33       env:
34         TWINE_USERNAME: ${{ secrets.pypi_username }}
35         TWINE_PASSWORD: ${{ secrets.pypi_password }}
36       run: |
37         for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
38             sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file;
39         done;
40         python -m build
41         twine upload dist/*