Repository navigation
92 lines (81 loc) · 2.95 KB
/
Copy pathbump-version.yml
File metadata and controls
92 lines (81 loc) · 2.95 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
on:
workflow_dispatch:
inputs:
package:
required: true
type: string
description: package name such as `sentry-arroyo`
version:
required: true
type: string
description: desired version such as `1.2.3`, or `latest` to pull the latest version from PyPI
pr_options:
type: string
default: ''
description: space-delimited additional options for gh pr create, such as asking for specific reviewers
# for use in other (cron/scheduled) workflows to bump specific
# company-internal dependencies on a more aggressive schedule
workflow_call:
inputs:
package:
required: true
type: string
version:
required: true
type: string
pr_options:
type: string
default: ''
secrets:
SENTRY_RELEASE_BOT_PRIVATE_KEY:
required: true
# Disable the default token permissions; the GitHub App token below supplies access.
permissions: {}
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: getsentry token
id: getsentry
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: ${{ steps.getsentry.outputs.token }}
- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
with:
version: '0.13.7'
- run: |
set -euxo pipefail
if [ "$VERSION" = latest ]; then
VERSION="$(curl -sL https://pypi.org/pypi/$PACKAGE/json | jq -r .info.version)"
fi
git checkout -b "bot/bump-version/$PACKAGE/$VERSION"
python3 -S -m tools.bump_version "$PACKAGE" "$VERSION"
if git diff --exit-code; then
exit 0
fi
git \
-c user.name=getsentry-bot \
-c user.email='10587625+getsentry-bot@users.noreply.github.com' \
commit \
--all \
--message "ref: bump $PACKAGE to $VERSION" \
--message "Co-Authored-By: $SENDER <$SENDER_ID+$SENDER@users.noreply.github.com>"
git push origin HEAD --quiet
# Keep caller-provided options as arguments rather than interpolating them into shell source.
if [[ -n "$PR_OPTIONS" ]]; then
read -r -a PR_OPTION_ARGS <<< "$PR_OPTIONS"
gh pr create --fill "${PR_OPTION_ARGS[@]}"
else
gh pr create --fill
fi
env:
GH_TOKEN: ${{ steps.getsentry.outputs.token }}
PACKAGE: ${{ inputs.package }}
VERSION: ${{ inputs.version }}
PR_OPTIONS: ${{ inputs.pr_options }}
SENDER: ${{ github.event.sender.login }}
SENDER_ID: ${{ github.event.sender.id }}