|
5 | 5 | branches: [main] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - Release: |
9 | | - name: Release |
10 | | - uses: equinor/ops-actions/.github/workflows/python-release.yml@main # TODO: pin to a release tag |
| 8 | + release-please: |
| 9 | + name: Release Please |
| 10 | + runs-on: ubuntu-24.04 |
11 | 11 | permissions: |
12 | | - contents: write |
13 | | - issues: write |
14 | | - pull-requests: write |
15 | | - id-token: write |
| 12 | + contents: write # Required to update changelog files. |
| 13 | + issues: write # Required to label issues. |
| 14 | + pull-requests: write # Required to create release PRs. |
| 15 | + steps: |
| 16 | + - name: Release Please |
| 17 | + id: release-please |
| 18 | + uses: googleapis/release-please-action@c2a5a2bd6a758a0937f1ddb1e8950609867ed15c |
| 19 | + with: |
| 20 | + config-file: release-please-config.json |
| 21 | + manifest-file: .release-please-manifest.json |
| 22 | + outputs: |
| 23 | + releases_created: ${{ steps.release-please.outputs.releases_created }} |
| 24 | + paths_released: ${{ steps.release-please.outputs.paths_released }} |
| 25 | + |
| 26 | + python-build: |
| 27 | + name: Python Build |
| 28 | + needs: release-please |
| 29 | + if: needs.release-please.outputs.releases_created == 'true' |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + path: ${{ fromJSON(needs.release-please.outputs.paths_released) }} |
| 33 | + runs-on: ubuntu-24.04 |
| 34 | + environment: pypi |
| 35 | + permissions: |
| 36 | + contents: read # Required to checkout the repository. |
| 37 | + id-token: write # Required for PyPI Trusted Publishing. |
| 38 | + defaults: |
| 39 | + run: |
| 40 | + shell: bash |
| 41 | + working-directory: ${{ matrix.path }} |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
| 45 | + with: |
| 46 | + persist-credentials: false |
| 47 | + |
| 48 | + - name: Setup Python |
| 49 | + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c |
| 50 | + with: |
| 51 | + python-version-file: .python-version |
| 52 | + |
| 53 | + - name: Install dependecies |
| 54 | + run: python -m pip install --upgrade pip build |
| 55 | + |
| 56 | + - name: Generate distributions |
| 57 | + # The build command will generate a source distribution (`.tar.gz` file) |
| 58 | + # and a built distribution (`.whl` file) in the `dist` directory. |
| 59 | + # Ref: https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives |
| 60 | + run: python -m build |
| 61 | + |
| 62 | + - name: Publish to PyPI |
| 63 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e |
| 64 | + with: |
| 65 | + packages-dir: ${{ matrix.path }}/dist |
0 commit comments