-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (55 loc) · 2.34 KB
/
prepare-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
name: Prepare Release
on:
workflow_dispatch:
inputs:
version:
description: "The version to prepare the release for"
required: true
jobs:
prepare-release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
# Make the github application be the committer
# (see: https://stackoverflow.com/a/74071223 on how to obtain the committer email)
- name: Setup git config
run: |
git config --global user.name "py-mine-ci-bot"
git config --global user.email "121461646+py-mine-ci-bot[bot]@users.noreply.github.com"
- name: Setup poetry
uses: ItsDrike/setup-poetry@v1
with:
python-version: 3.13
install-args: "--no-root --only release"
- name: Checkout new branch
run: git checkout -b "prepare-release-${{ github.event.inputs.version }}"
- name: Run towncrier
run: towncrier build --yes --version "${{ github.event.inputs.version }}"
- name: Commit changes
run: git commit -am "Prepare for release of version ${{ github.event.inputs.version }}"
- name: Push changes
run: git push origin "prepare-release-${{ github.event.inputs.version }}"
- name: Create pull request
uses: repo-sync/pull-request@v2
with:
# We need to use a bot token to be able to trigger workflows that listen to pull_request calls
github_token: ${{ steps.generate_token.outputs.token }}
source_branch: prepare-release-${{ github.event.inputs.version }}
destination_branch: main
pr_assignee: ${{ github.event.sender.login }}
pr_title: Prepare for release of ${{ github.event.inputs.version }}
pr_label: "a: dependencies,t: release"
pr_body: |
Release preparation triggered by @${{ github.event.sender.login }}.
Once the pull request is merged, you can trigger a PyPI release by pushing a \`v${{ github.event.inputs.version }}\` git tag in the repository.