|
24 | 24 | runs-on: ${{ matrix.os }} |
25 | 25 | strategy: |
26 | 26 | matrix: |
27 | | - python-version: ['3.10', '3.13'] |
| 27 | + python-version: ['3.10', '3.11', '3.12', '3.13'] |
28 | 28 | os: [ubuntu-latest, windows-latest] |
29 | 29 |
|
30 | 30 | steps: |
@@ -74,24 +74,87 @@ jobs: |
74 | 74 | run: | |
75 | 75 | pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure |
76 | 76 |
|
77 | | - publish: |
78 | | - name: Publish to PyPi |
79 | | - needs: [pre-commit, tests, pre-commit-hook] |
80 | | - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 77 | + build: |
| 78 | + name: build |
81 | 79 | runs-on: ubuntu-latest |
82 | 80 | steps: |
83 | | - - name: Checkout source |
84 | | - uses: actions/checkout@v4 |
85 | | - - name: Set up Python 3 |
86 | | - uses: actions/setup-python@v5 |
87 | | - with: |
88 | | - python-version: '3.x' |
89 | | - - name: install flit |
90 | | - run: | |
91 | | - pip install flit>=3.12.0 |
92 | | - - name: Build and publish |
93 | | - run: | |
94 | | - flit publish |
95 | | - env: |
96 | | - FLIT_USERNAME: __token__ |
97 | | - FLIT_PASSWORD: ${{ secrets.PYPI_KEY }} |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - name: Set up Python |
| 83 | + uses: actions/setup-python@v5 |
| 84 | + with: |
| 85 | + python-version: "3.x" |
| 86 | + - name: Upgrade Pip |
| 87 | + run: python -m pip install --upgrade pip |
| 88 | + - name: Install Poetry |
| 89 | + run: python -m pip install build |
| 90 | + - name: Build a binary wheel and a source tarball |
| 91 | + run: python3 -m build |
| 92 | + - name: Store the distribution packages |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: python-package-distributions |
| 96 | + path: dist/ |
| 97 | + |
| 98 | + publish-to-pypi: |
| 99 | + name: >- |
| 100 | + Publish Python 🐍 distribution 📦 to PyPI |
| 101 | + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
| 102 | + needs: |
| 103 | + - build |
| 104 | + runs-on: ubuntu-latest |
| 105 | + environment: |
| 106 | + name: pypi |
| 107 | + url: https://pypi.org/p/mdformat_footnote |
| 108 | + permissions: |
| 109 | + id-token: write |
| 110 | + steps: |
| 111 | + - name: Download all the dists |
| 112 | + uses: actions/download-artifact@v4 |
| 113 | + with: |
| 114 | + name: python-package-distributions |
| 115 | + path: dist/ |
| 116 | + - name: Publish distribution 📦 to PyPI |
| 117 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 118 | + |
| 119 | + github-release: |
| 120 | + name: >- |
| 121 | + Sign the Python 🐍 distribution 📦 with Sigstore |
| 122 | + and upload them to GitHub Release |
| 123 | + needs: |
| 124 | + - publish-to-pypi |
| 125 | + runs-on: ubuntu-latest |
| 126 | + |
| 127 | + permissions: |
| 128 | + contents: write # IMPORTANT: mandatory for making GitHub Releases |
| 129 | + id-token: write # IMPORTANT: mandatory for sigstore |
| 130 | + |
| 131 | + steps: |
| 132 | + - name: Download all the dists |
| 133 | + uses: actions/download-artifact@v4 |
| 134 | + with: |
| 135 | + name: python-package-distributions |
| 136 | + path: dist/ |
| 137 | + - name: Sign the dists with Sigstore |
| 138 | + uses: sigstore/gh-action-sigstore-python@v2.1.1 |
| 139 | + with: |
| 140 | + inputs: >- |
| 141 | + ./dist/*.tar.gz |
| 142 | + ./dist/*.whl |
| 143 | + - name: Create GitHub Release |
| 144 | + env: |
| 145 | + GITHUB_TOKEN: ${{ github.token }} |
| 146 | + run: >- |
| 147 | + gh release create |
| 148 | + '${{ github.ref_name }}' |
| 149 | + --repo '${{ github.repository }}' |
| 150 | + --notes "" |
| 151 | + - name: Upload artifact signatures to GitHub Release |
| 152 | + env: |
| 153 | + GITHUB_TOKEN: ${{ github.token }} |
| 154 | + # Upload to GitHub Release using the `gh` CLI. |
| 155 | + # `dist/` contains the built packages, and the |
| 156 | + # sigstore-produced signatures and certificates. |
| 157 | + run: >- |
| 158 | + gh release upload |
| 159 | + '${{ github.ref_name }}' dist/** |
| 160 | + --repo '${{ github.repository }}' |
0 commit comments