chore(main): release 6.3.1 #581
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Please | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: Build and publish the current pyproject version to PyPI | |
| type: boolean | |
| default: false | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Release Please must write release PR branches with an installation token, | |
| # not the default GITHUB_TOKEN. GITHUB_TOKEN-authored pushes do not trigger | |
| # downstream pull_request workflows, so protected release PRs can sit | |
| # blocked waiting for CI/IPR contexts that never start. | |
| - name: Mint App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| app-id: ${{ secrets.IPR_APP_ID }} | |
| private-key: ${{ secrets.IPR_APP_PRIVATE_KEY }} | |
| - uses: googleapis/release-please-action@v5 | |
| id: release | |
| if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish != true }} | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| - name: Checkout release PR | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Normalize release PR pyproject prerelease version | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| run: | | |
| set -euo pipefail | |
| BASE_RELEASE_PR_BRANCH="release-please--branches--${{ github.ref_name }}" | |
| COMPONENT_RELEASE_PR_BRANCH="${BASE_RELEASE_PR_BRANCH}--components--adcp" | |
| if git ls-remote --exit-code --heads origin "${COMPONENT_RELEASE_PR_BRANCH}" >/dev/null 2>&1; then | |
| RELEASE_PR_BRANCH="${COMPONENT_RELEASE_PR_BRANCH}" | |
| elif git ls-remote --exit-code --heads origin "${BASE_RELEASE_PR_BRANCH}" >/dev/null 2>&1; then | |
| RELEASE_PR_BRANCH="${BASE_RELEASE_PR_BRANCH}" | |
| else | |
| echo "No release PR branch found to normalize" | |
| exit 0 | |
| fi | |
| git fetch origin "${RELEASE_PR_BRANCH}:${RELEASE_PR_BRANCH}" | |
| git switch "${RELEASE_PR_BRANCH}" | |
| python3 scripts/normalize_pyproject_prerelease.py pyproject.toml | |
| if git diff --quiet -- pyproject.toml; then | |
| echo "pyproject.toml already uses a PEP 440-compatible version" | |
| exit 0 | |
| fi | |
| git config user.name "aao-ipr-bot[bot]" | |
| git config user.email "aao-ipr-bot[bot]@users.noreply.github.com" | |
| git add pyproject.toml | |
| git commit -m "chore: normalize prerelease version to PEP 440" | |
| git push origin "HEAD:${RELEASE_PR_BRANCH}" | |
| # Publish to PyPI when a release is created | |
| - name: Checkout | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - name: Install build dependencies | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Bundle schemas | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| run: python scripts/bundle_schemas.py | |
| - name: Build package | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| run: python -m build | |
| - name: Publish to PyPI | |
| if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }} | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPY_API_TOKEN }} | |
| run: twine upload dist/* |