-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
74 lines (64 loc) · 2.26 KB
/
bump-version.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
67
68
69
70
71
72
73
74
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: additional options for gh pr create, such as for 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: ''
# disable all permissions -- we use the PAT's permissions instead
permissions: {}
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.BUMP_SENTRY_TOKEN }}
- 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"
re="$(sed 's/[_-]/[_-]/g' <<< "$PACKAGE")"
sed -i "s/^$re==.*/$PACKAGE==$VERSION/g" -- requirements*.txt
sed -i "s/^$re>=.*/$PACKAGE>=$VERSION/g" -- requirements*.txt
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
gh pr create --fill ${{ inputs.pr_options }}
env:
GH_TOKEN: ${{ secrets.BUMP_SENTRY_TOKEN }}
PACKAGE: ${{ inputs.package }}
VERSION: ${{ inputs.version }}
SENDER: ${{ github.event.sender.login }}
SENDER_ID: ${{ github.event.sender.id }}