|
1 | 1 | name: Continuous Integration |
2 | 2 |
|
3 | 3 | on: |
| 4 | + push: |
| 5 | + branches: [ $default-branch ] |
4 | 6 | pull_request: |
5 | 7 | paths: |
6 | 8 | - '**.py' |
|
34 | 36 | run: poetry run python setup_binary.py download_pandoc |
35 | 37 | - name: run tests |
36 | 38 | run: poetry run python tests.py |
| 39 | + |
| 40 | + builder: |
| 41 | + needs: [test] |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + os: [macos-10.15, windows-2019] |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + steps: |
| 47 | + - name: Check out repository |
| 48 | + uses: actions/checkout@v2 |
| 49 | + - name: Discover python architecture |
| 50 | + run: | |
| 51 | + if [ "$RUNNER_OS" == "Windows" ]; then |
| 52 | + echo "PYTHON_ARCHITECTURE=x86" >> $GITHUB_ENV |
| 53 | + else |
| 54 | + echo "PYTHON_ARCHITECTURE=x64" >> $GITHUB_ENV |
| 55 | + fi |
| 56 | + - name: Set up python |
| 57 | + uses: actions/setup-python@v3 |
| 58 | + with: |
| 59 | + python-version: "3.9.x" |
| 60 | + architecture: "${{ env.PYTHON_ARCHITECTURE }}" |
| 61 | + - name: Print Python Information |
| 62 | + run: python -VV |
| 63 | + - name: Update dependencies |
| 64 | + run: python -m pip install -U pip wheel setuptools twine |
| 65 | + - name: Build universal source Archive and wheel |
| 66 | + run: python setup.py sdist bdist_wheel |
| 67 | + - name: Build binary Archive |
| 68 | + run: python setup_binary.py download_pandoc bdist_wheel |
| 69 | + - name: Upload artifacts |
| 70 | + uses: actions/upload-artifact@v3 |
| 71 | + with: |
| 72 | + name: python-package-distributions |
| 73 | + path: dist/ |
| 74 | + |
| 75 | + publisher_release: |
| 76 | + needs: [builder] |
| 77 | + if: startsWith(github.event.ref, 'refs/tags/v') |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - name: Check out repository |
| 81 | + uses: actions/checkout@v3 |
| 82 | + - name: Download artifacts |
| 83 | + uses: actions/download-artifact@v3 |
| 84 | + with: |
| 85 | + name: python-package-distributions |
| 86 | + path: dist/ |
| 87 | + - name: Publish to PyPI |
| 88 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 89 | + with: |
| 90 | + verbose: true |
| 91 | + user: __token__ |
| 92 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 93 | + |
| 94 | + publisher_latest: |
| 95 | + needs: [builder] |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - name: Check out repository |
| 99 | + uses: actions/checkout@v3 |
| 100 | + - name: Download artifacts |
| 101 | + uses: actions/download-artifact@v3 |
| 102 | + with: |
| 103 | + name: python-package-distributions |
| 104 | + path: dist/ |
| 105 | + - name: Make release |
| 106 | + uses: "marvinpinto/action-automatic-releases@v1.2.1" |
| 107 | + with: |
| 108 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 109 | + prerelease: true |
| 110 | + title: "Latest Development Version" |
| 111 | + automatic_release_tag: "latest" |
| 112 | + files: dist/* |
0 commit comments