|
1 | 1 | name: Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - release: |
5 |
| - types: |
6 |
| - - published |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + branches: |
| 7 | + - master |
7 | 8 |
|
8 | 9 | jobs:
|
9 |
| - upload_release: |
10 |
| - name: Upload release |
11 |
| - runs-on: ubuntu-20.04 |
| 10 | + create_release: |
| 11 | + name: Create release |
| 12 | + runs-on: ubuntu-latest |
| 13 | + if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') |
12 | 14 | steps:
|
13 |
| - - uses: actions/checkout@v2 |
14 |
| - # Include all history and tags, needed for building the right version |
| 15 | + - name: Get GitHub App token |
| 16 | + id: get_token |
| 17 | + uses: tibdex/github-app-token@v1 |
15 | 18 | with:
|
16 |
| - fetch-depth: 0 |
17 |
| - |
18 |
| - - uses: actions/setup-python@v2 |
19 |
| - name: Install Python |
| 19 | + app_id: ${{ secrets.PIPELINE_GITHUB_APP_ID }} |
| 20 | + private_key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }} |
| 21 | + - name: Create release |
| 22 | + uses: actions/github-script@v5 |
| 23 | + env: |
| 24 | + RELEASE_BRANCH: ${{ github.head_ref }} |
20 | 25 | with:
|
21 |
| - python-version: "3.10" |
22 |
| - |
23 |
| - - name: Install datadog_checks_dev |
24 |
| - run: | |
25 |
| - python -m pip install datadog_checks_dev[cli] |
| 26 | + github-token: ${{ steps.get_token.outputs.token }} |
| 27 | + script: | |
| 28 | + const tagName = process.env.RELEASE_BRANCH.split("/")[1]; |
26 | 29 |
|
27 |
| - - name: Set ddev pypi credentials |
28 |
| - run: | |
29 |
| - ddev config set pypi.user __token__ |
30 |
| - ddev config set pypi.pass ${{ secrets.PYPI_TOKEN }} |
| 30 | + await github.rest.git.createRef({ |
| 31 | + owner: context.repo.owner, |
| 32 | + repo: context.repo.repo, |
| 33 | + ref: `refs/tags/${tagName}`, |
| 34 | + sha: context.payload.pull_request.merge_commit_sha, |
| 35 | + }); |
31 | 36 |
|
32 |
| - - name: Publish the wheel to PyPI |
33 |
| - run: | |
34 |
| - ddev release upload . |
| 37 | + await github.rest.repos.createRelease({ |
| 38 | + owner: context.repo.owner, |
| 39 | + repo: context.repo.repo, |
| 40 | + generate_release_notes: true, |
| 41 | + tag_name: tagName, |
| 42 | + }); |
0 commit comments