forked from open-telemetry/opentelemetry-proto-java
-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (62 loc) · 2.38 KB
/
prepare-release-branch.yml
File metadata and controls
74 lines (62 loc) · 2.38 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
name: Prepare release branch
on:
workflow_dispatch:
permissions:
contents: read
jobs:
prereqs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Verify prerequisites
run: |
if [[ $GITHUB_REF_NAME != main ]]; then
echo this workflow should only be run against main
exit 1
fi
create-pull-request-against-release-branch:
permissions:
contents: write # for git push to PR branch
runs-on: ubuntu-latest
needs:
- prereqs
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# history is needed to allow fast-forward push below in case
# re-running this workflow after merging additional PRs to main
fetch-depth: 0
- name: Create release branch
run: |
version=$(.github/scripts/get-version.sh)
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
release_branch_name="release/v${version}"
else
echo "unexpected version: $version"
exit 1
fi
git push origin HEAD:$release_branch_name
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- name: Update version
run: sed -Ei "s/val snapshot = true/val snapshot = false/" build.gradle.kts
- name: Use CLA approved bot
run: .github/scripts/use-cla-approved-bot.sh
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
- name: Create pull request against the release branch
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
run: |
message="Prepare release $VERSION"
branch="otelbot/prepare-release-${VERSION}"
git checkout -b $branch
git commit -a -m "$message"
git push --set-upstream origin $branch
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--base $RELEASE_BRANCH_NAME