|
1 | | -name: Release |
| 1 | +name: Main Pipeline |
2 | 2 |
|
3 | 3 | on: |
| 4 | + pull_request: |
| 5 | + branches: [master] |
4 | 6 | push: |
5 | | - branches: |
6 | | - - master |
| 7 | + branches: [master] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
7 | 12 |
|
8 | 13 | jobs: |
| 14 | + test: |
| 15 | + if: github.event_name == 'pull_request' |
| 16 | + uses: ./.github/workflows/release-test.yml |
9 | 17 |
|
10 | | - test: |
11 | | - uses: ./.github/workflows/release-test.yml |
| 18 | + release-please: |
| 19 | + if: github.event_name == 'push' |
| 20 | + uses: circlefin/circle-public-github-workflows/.github/workflows/conventional-commit-release.yaml@main |
| 21 | + with: |
| 22 | + release_type: python |
| 23 | + additional_unqualified_tags: true |
| 24 | + extra_tags: stable |
| 25 | + secrets: |
| 26 | + RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
12 | 27 |
|
13 | | - release: |
14 | | - name: Release |
15 | | - runs-on: large-spot |
16 | | - needs: test |
17 | | - steps: |
18 | | - - uses: actions/checkout@v4 |
19 | | - |
20 | | - - name: Set up Python |
21 | | - uses: actions/setup-python@v5 |
22 | | - with: |
23 | | - python-version: '3.10' |
24 | | - |
25 | | - - name: Install build dependencies |
26 | | - run: | |
27 | | - python -m pip install --upgrade pip |
28 | | - python -m pip install build twine |
29 | | - |
30 | | - - name: Build package |
31 | | - run: python -m build |
| 28 | + pypi-publish: |
| 29 | + name: Publish to PyPI |
| 30 | + if: needs.release-please.outputs.release_created == 'true' |
| 31 | + needs: release-please |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Set up Python |
| 37 | + uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + python-version: '3.10' |
32 | 40 |
|
33 | | - - name: Check distribution |
34 | | - run: twine check dist/* |
| 41 | + - name: Install build dependencies |
| 42 | + run: | |
| 43 | + python -m pip install --upgrade pip |
| 44 | + python -m pip install build twine |
35 | 45 | |
36 | | - - name: Publish to PyPI |
37 | | - env: |
38 | | - TWINE_USERNAME: __token__ |
39 | | - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
40 | | - run: twine upload dist/* |
| 46 | + - name: Build package |
| 47 | + run: python -m build |
| 48 | + |
| 49 | + - name: Check distribution |
| 50 | + run: twine check dist/* |
| 51 | + |
| 52 | + - name: Publish to PyPI |
| 53 | + env: |
| 54 | + TWINE_USERNAME: __token__ |
| 55 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 56 | + run: twine upload dist/* |
| 57 | + |
| 58 | + - name: Upload build artifacts for release |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: python-package-distributions |
| 62 | + path: dist/ |
| 63 | + |
| 64 | + github-release: |
| 65 | + name: Create GitHub Release with Assets |
| 66 | + if: needs.release-please.outputs.release_created == 'true' |
| 67 | + needs: [release-please, pypi-publish] |
| 68 | + uses: circlefin/circle-public-github-workflows/.github/workflows/attach-release-assets.yaml@main |
| 69 | + with: |
| 70 | + release_tag: ${{ needs.release-please.outputs.release_tag }} |
| 71 | + artifact_file_globs: | |
| 72 | + *.whl |
| 73 | + *.tar.gz |
| 74 | + create_manifest: true |
| 75 | + generate_sbom: true |
0 commit comments