|  | 
| 1 | 1 | name: Release | 
| 2 | 2 | 
 | 
| 3 | 3 | on: | 
| 4 |  | -  release: | 
| 5 |  | -    types: [published] | 
| 6 |  | - | 
| 7 |  | -concurrency: | 
| 8 |  | -  group: release-${{ github.event.release.tag_name }} | 
|  | 4 | +  workflow_dispatch: | 
|  | 5 | +    inputs: | 
|  | 6 | +      version: | 
|  | 7 | +        description: Version to release | 
|  | 8 | +        required: true | 
|  | 9 | +      merge_target: | 
|  | 10 | +        description: Target branch to merge into. Uses the default branch as a fallback (optional) | 
|  | 11 | +        required: true | 
| 9 | 12 | 
 | 
| 10 | 13 | jobs: | 
| 11 |  | -  build-and-publish-ext: | 
|  | 14 | +  release: | 
| 12 | 15 |     runs-on: ubuntu-latest | 
| 13 |  | -    environment: | 
| 14 |  | -      name: release-ext | 
| 15 |  | -      url: https://pypi.org/p/django-stubs-ext | 
| 16 |  | -    permissions: | 
| 17 |  | -      id-token: write | 
|  | 16 | +    name: "Release a new version" | 
| 18 | 17 |     steps: | 
| 19 |  | -      - name: Setup python to build package | 
| 20 |  | -        uses: actions/setup-python@v6 | 
|  | 18 | +      - name: Get auth token | 
|  | 19 | +        id: token | 
|  | 20 | +        uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | 
| 21 | 21 |         with: | 
| 22 |  | -          python-version: '3.12' | 
| 23 |  | -      - name: Install build | 
| 24 |  | -        run: python -m pip install build | 
| 25 |  | -      - uses: actions/checkout@v5 | 
|  | 22 | +          app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} | 
|  | 23 | +          private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} | 
|  | 24 | +      - uses: actions/checkout@v4 | 
| 26 | 25 |         with: | 
|  | 26 | +          token: ${{ steps.token.outputs.token }} | 
| 27 | 27 |           fetch-depth: 0 | 
| 28 |  | -      - name: Build ext package | 
| 29 |  | -        run: python -m build ext/ | 
| 30 |  | -      - name: Publish ext to PyPI | 
| 31 |  | - | 
|  | 28 | +      - name: Prepare release | 
|  | 29 | +        uses: getsentry/action-prepare-release@v1 | 
|  | 30 | +        env: | 
|  | 31 | +          GITHUB_TOKEN: ${{ steps.token.outputs.token }} | 
| 32 | 32 |         with: | 
| 33 |  | -          packages-dir: ext/dist/ | 
| 34 |  | - | 
| 35 |  | -  build-and-publish: | 
| 36 |  | -    runs-on: ubuntu-latest | 
| 37 |  | -    needs: [build-and-publish-ext] | 
| 38 |  | -    environment: | 
| 39 |  | -      name: release | 
| 40 |  | -      url: https://pypi.org/p/django-stubs | 
| 41 |  | -    permissions: | 
| 42 |  | -      id-token: write | 
| 43 |  | -    steps: | 
| 44 |  | -      - name: Setup python to build package | 
| 45 |  | -        uses: actions/setup-python@v6 | 
| 46 |  | -        with: | 
| 47 |  | -          python-version: '3.12' | 
| 48 |  | -      - name: Install build | 
| 49 |  | -        run: python -m pip install build | 
| 50 |  | -      - uses: actions/checkout@v5 | 
| 51 |  | -        with: | 
| 52 |  | -          fetch-depth: 0 | 
| 53 |  | -      - name: Build package | 
| 54 |  | -        run: python -m build | 
| 55 |  | -      - name: Publish to PyPI | 
| 56 |  | - | 
|  | 33 | +          version: ${{ github.event.inputs.version }} | 
|  | 34 | +          merge_target: ${{ github.event.inputs.merge_target }} | 
0 commit comments