|
| 1 | +# Copyright (c) 2025 Contributors to the Eclipse Foundation |
| 2 | +# |
| 3 | +# This program and the accompanying materials are made available under the |
| 4 | +# terms of the Apache License, Version 2.0 which is available at |
| 5 | +# https://www.apache.org/licenses/LICENSE-2.0. |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | +# |
| 13 | +# SPDX-License-Identifier: Apache-2.0 |
| 14 | + |
| 15 | +name: Publish Python 🐍 distribution 📦 to PyPI |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + tags: |
| 20 | + - "v*.*.*" |
| 21 | + |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + name: Build distribution 📦 |
| 25 | + runs-on: ubuntu-22.04 |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - name: Set up Python |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: "3.10" |
| 33 | + - name: Install pypa/build |
| 34 | + run: pip install build --user |
| 35 | + - name: Build a binary wheel and a source tarball |
| 36 | + run: python3 -m build |
| 37 | + - name: Store the distribution packages |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: python-package-distributions |
| 41 | + path: | |
| 42 | + dist/ |
| 43 | + LICENSE |
| 44 | + NOTICE.md |
| 45 | +
|
| 46 | + publish-to-pypi: |
| 47 | + name: Publish Python 🐍 distribution 📦 to PyPI |
| 48 | + needs: |
| 49 | + - build |
| 50 | + runs-on: ubuntu-22.04 |
| 51 | + environment: |
| 52 | + name: pypi |
| 53 | + url: https://pypi.org/p/velocitas-model-generator |
| 54 | + |
| 55 | + permissions: |
| 56 | + id-token: write |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Download dists folder |
| 60 | + uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + name: python-package-distributions |
| 63 | + path: python-package/ |
| 64 | + - name: Publish distribution 📦 to PyPI |
| 65 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 66 | + with: |
| 67 | + packages-dir: python-package/dist |
| 68 | + |
| 69 | + github-release: |
| 70 | + name: >- |
| 71 | + Sign the Python 🐍 distribution 📦 with Sigstore |
| 72 | + and upload them to GitHub Release |
| 73 | + needs: |
| 74 | + - build |
| 75 | + runs-on: ubuntu-22.04 |
| 76 | + |
| 77 | + permissions: |
| 78 | + contents: write |
| 79 | + id-token: write |
| 80 | + |
| 81 | + steps: |
| 82 | + - name: Download dists folder |
| 83 | + uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + name: python-package-distributions |
| 86 | + path: python-package/ |
| 87 | + - name: Sign the dists with Sigstore |
| 88 | + uses: sigstore/gh-action-sigstore-python@v3.0.0 |
| 89 | + with: |
| 90 | + inputs: >- |
| 91 | + ./python-package/dist/*.tar.gz |
| 92 | + ./python-package/dist/*.whl |
| 93 | + - name: Create release |
| 94 | + id: create_release |
| 95 | + uses: softprops/action-gh-release@v2 |
| 96 | + with: |
| 97 | + files: | |
| 98 | + python-package/dist/** |
| 99 | + python-package/LICENSE |
| 100 | + python-package/NOTICE.md |
0 commit comments