|
| 1 | +name: Release Please |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-please: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + release_created: ${{ steps.release.outputs.release_created }} |
| 17 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 18 | + version: ${{ steps.release.outputs.version }} |
| 19 | + steps: |
| 20 | + - uses: google-github-actions/release-please-action@v4 |
| 21 | + id: release |
| 22 | + with: |
| 23 | + release-type: python |
| 24 | + package-name: filepattern |
| 25 | + |
| 26 | + # If a release was created, update version files and create a follow-up commit |
| 27 | + - name: Checkout code |
| 28 | + if: ${{ steps.release.outputs.release_created }} |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + ref: ${{ steps.release.outputs.tag_name }} |
| 32 | + |
| 33 | + - name: Set up Python |
| 34 | + if: ${{ steps.release.outputs.release_created }} |
| 35 | + uses: actions/setup-python@v5 |
| 36 | + with: |
| 37 | + python-version: '3.11' |
| 38 | + |
| 39 | + - name: Install setuptools-scm |
| 40 | + if: ${{ steps.release.outputs.release_created }} |
| 41 | + run: pip install setuptools-scm |
| 42 | + |
| 43 | + - name: Update version files |
| 44 | + if: ${{ steps.release.outputs.release_created }} |
| 45 | + run: | |
| 46 | + python scripts/update_versions.py --version ${{ steps.release.outputs.version }} |
| 47 | + echo "Updated version files to ${{ steps.release.outputs.version }}" |
| 48 | +
|
| 49 | + - name: Upload VERSION file as release asset |
| 50 | + if: ${{ steps.release.outputs.release_created }} |
| 51 | + env: |
| 52 | + GH_TOKEN: ${{ github.token }} |
| 53 | + run: | |
| 54 | + gh release upload ${{ steps.release.outputs.tag_name }} VERSION --clobber |
| 55 | +
|
| 56 | + trigger-publish: |
| 57 | + needs: release-please |
| 58 | + if: ${{ needs.release-please.outputs.release_created }} |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - name: Trigger PyPI publish |
| 62 | + uses: actions/github-script@v7 |
| 63 | + with: |
| 64 | + script: | |
| 65 | + github.rest.actions.createWorkflowDispatch({ |
| 66 | + owner: context.repo.owner, |
| 67 | + repo: context.repo.repo, |
| 68 | + workflow_id: 'publish_pypi.yml', |
| 69 | + ref: '${{ needs.release-please.outputs.tag_name }}' |
| 70 | + }) |
| 71 | +
|
| 72 | + - name: Trigger Maven publish |
| 73 | + uses: actions/github-script@v7 |
| 74 | + with: |
| 75 | + script: | |
| 76 | + github.rest.actions.createWorkflowDispatch({ |
| 77 | + owner: context.repo.owner, |
| 78 | + repo: context.repo.repo, |
| 79 | + workflow_id: 'publish_maven.yml', |
| 80 | + ref: '${{ needs.release-please.outputs.tag_name }}' |
| 81 | + }) |
0 commit comments