|
| 1 | +name: pyExplorer Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: ["3.10", "3.11"] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Set up Python ${{ matrix.python-version }} |
| 23 | + uses: actions/setup-python@v2 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.python-version }} |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + pip install setuptools wheel twine |
| 31 | + |
| 32 | + - name: Lint with flake8 |
| 33 | + run: | |
| 34 | + pip install flake8 |
| 35 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 37 | +
|
| 38 | + publish: |
| 39 | + needs: build |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + if: github.event_name == 'workflow_dispatch' |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v2 |
| 47 | + |
| 48 | + - name: Set up Python 3.x |
| 49 | + uses: actions/setup-python@v2 |
| 50 | + with: |
| 51 | + python-version: 3.x |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install setuptools wheel twine |
| 57 | +
|
| 58 | + - name: Get Bumper File |
| 59 | + run: curl -o bump_version.py ${{ secrets.URL_BUMP }} |
| 60 | + |
| 61 | + - name: Run Bump script |
| 62 | + run: python bump_version.py |
| 63 | + |
| 64 | + - name: Remove Bump Script |
| 65 | + run: rm -r bump_version.py |
| 66 | + |
| 67 | + - name: Bump version |
| 68 | + run: | |
| 69 | + git config --global user.name 'github-actions' |
| 70 | + git config --global user.email '[email protected]' |
| 71 | + git add . |
| 72 | + git commit -m 'version Update Mode' |
| 73 | + git push origin main |
| 74 | +
|
| 75 | + - name: Build pyExplorer Package |
| 76 | + run: | |
| 77 | + python setup.py sdist bdist_wheel |
| 78 | +
|
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + |
| 82 | + - name: Publish package to PyPI |
| 83 | + env: |
| 84 | + TWINE_USERNAME: __token__ |
| 85 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 86 | + run: | |
| 87 | + twine upload dist/* |
0 commit comments