|
1 | | -name: "Release" |
2 | | -description: 'Publishes python package to PyPI' |
| 1 | +name: Release |
3 | 2 |
|
| 3 | +# Conforms to the umbrella SDK release pipeline contract: |
| 4 | +# u5c-factory reference/sdk-pipeline-requirements.md |
4 | 5 | on: |
5 | | - workflow_dispatch: |
6 | 6 | push: |
7 | | - tags: [v*] |
| 7 | + tags: ['v*'] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
| 10 | + verify: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Verify tag matches package version |
| 15 | + run: | |
| 16 | + TAG="${GITHUB_REF_NAME#v}" |
| 17 | + MANIFEST=$(sed -nE 's/^version = "(.+)"/\1/p' pyproject.toml | head -1) |
| 18 | + if [ "$TAG" != "$MANIFEST" ]; then |
| 19 | + echo "::error::tag $GITHUB_REF_NAME does not match pyproject.toml version $MANIFEST" |
| 20 | + exit 1 |
| 21 | + fi |
13 | 22 |
|
14 | | - - name: Set up Python |
15 | | - uses: actions/setup-python@v5 |
16 | | - with: |
17 | | - python-version: "3.10" |
| 23 | + build: |
| 24 | + needs: verify |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - run: pipx install poetry |
| 29 | + - uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: "3.10" |
| 32 | + cache: poetry |
| 33 | + # Relock first: poetry.lock is stale vs pyproject.toml (see ci.yml). |
| 34 | + - run: poetry lock |
| 35 | + - run: poetry install |
| 36 | + - run: poetry build |
18 | 37 |
|
19 | | - - name: Install Poetry |
20 | | - shell: bash |
21 | | - run: pip install --no-input poetry |
| 38 | + test: |
| 39 | + needs: build |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - run: pipx install poetry |
| 44 | + - uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: "3.10" |
| 47 | + cache: poetry |
| 48 | + - run: poetry lock |
| 49 | + - run: poetry install |
| 50 | + # No pytest suite yet; import-smoke the package (see ci.yml). |
| 51 | + - run: poetry run python -c "import utxorpc" |
22 | 52 |
|
23 | | - - name: Publish to PyPI |
24 | | - shell: bash |
25 | | - env: |
26 | | - PYPI_TOKEN: ${{ inputs.registry-token }} |
27 | | - run: | |
28 | | - poetry publish --build --username __token__ --password $PYPI_TOKEN |
| 53 | + publish: |
| 54 | + needs: test |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + - run: pipx install poetry |
| 59 | + - uses: actions/setup-python@v5 |
| 60 | + with: |
| 61 | + python-version: "3.10" |
| 62 | + cache: poetry |
| 63 | + - name: Publish to PyPI |
| 64 | + env: |
| 65 | + PYPI_REGISTRY_TOKEN: ${{ secrets.PYPI_REGISTRY_TOKEN }} |
| 66 | + run: poetry publish --build --username __token__ --password "$PYPI_REGISTRY_TOKEN" |
0 commit comments