]> Repositories - Adafruit_Blinka-hackapet.git/blob - .github/workflows/release.yml
Added pre-commit support
[Adafruit_Blinka-hackapet.git] / .github / workflows / release.yml
1 # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2 #
3 # SPDX-License-Identifier: Unlicense
4 name: Release Actions
5
6 on:
7   release:
8     types: [published]
9
10 jobs:
11   upload-pypi:
12     runs-on: ubuntu-latest
13     steps:
14     - uses: actions/checkout@v1
15     - name: Check For setup.py
16       id: need-pypi
17       run: |
18         echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
19     - name: Set up Python
20       if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
21       uses: actions/setup-python@v1
22       with:
23         python-version: '3.x'
24     - name: Install dependencies
25       if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
26       run: |
27         python -m pip install --upgrade pip
28         pip install setuptools wheel twine
29     - name: Build and publish
30       if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
31       env:
32         TWINE_USERNAME: ${{ secrets.pypi_username }}
33         TWINE_PASSWORD: ${{ secrets.pypi_password }}
34       run: |
35         for file in $(find -not -path "./.*" -not -path "./docs*" -name "*.py"); do
36             sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file;
37         done;
38         python setup.py sdist
39         twine upload dist/*