|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-release: |
| 10 | + name: Build Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Set up Python |
| 16 | + uses: actions/setup-python@v2 |
| 17 | + with: |
| 18 | + python-version: 3.7 |
| 19 | + |
| 20 | + - name: Install packages |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip build |
| 23 | + python -m pip install --upgrade --upgrade-strategy eager -e .[dev] |
| 24 | +
|
| 25 | + - name: Build a binary wheel and a source tarball |
| 26 | + run: | |
| 27 | + python -m build --sdist --wheel --outdir dist/ |
| 28 | +
|
| 29 | + - name: Publish build artifacts |
| 30 | + uses: actions/upload-artifact@v2 |
| 31 | + with: |
| 32 | + name: built-package |
| 33 | + path: "./dist" |
| 34 | + |
| 35 | + publish-test-release: |
| 36 | + name: Publish release to Test PyPI |
| 37 | + needs: [build-release] |
| 38 | + environment: "test" |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Download build artifacts |
| 43 | + uses: actions/download-artifact@v2 |
| 44 | + with: |
| 45 | + name: built-package |
| 46 | + path: './dist' |
| 47 | + |
| 48 | + - name: Publish distribution to Test PyPI |
| 49 | + uses: pypa/gh-action-pypi-publish@master |
| 50 | + with: |
| 51 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 52 | + repository_url: https://test.pypi.org/legacy/ |
| 53 | + |
| 54 | + build-and-publish-docs: |
| 55 | + name: Build and publish docs |
| 56 | + needs: [build-release, publish-test-release] |
| 57 | + runs-on: ubuntu-latest |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v2 |
| 61 | + |
| 62 | + - name: Build docs |
| 63 | + run: | |
| 64 | + python -m pip install --upgrade pip |
| 65 | + python -m pip install --upgrade --upgrade-strategy eager -e .[dev] |
| 66 | + mkdocs build |
| 67 | +
|
| 68 | + - name: Publish docs |
| 69 | + |
| 70 | + with: |
| 71 | + branch: docs |
| 72 | + folder: site |
| 73 | + |
| 74 | + publish-release: |
| 75 | + name: Publish release to PyPI |
| 76 | + needs: [build-release, publish-test-release, build-and-publish-docs] |
| 77 | + environment: "prod" |
| 78 | + runs-on: ubuntu-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Download build artifacts |
| 82 | + uses: actions/download-artifact@v2 |
| 83 | + with: |
| 84 | + name: built-package |
| 85 | + path: './dist' |
| 86 | + |
| 87 | + - name: Publish distribution to PyPI |
| 88 | + uses: pypa/gh-action-pypi-publish@master |
| 89 | + with: |
| 90 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments