-
Notifications
You must be signed in to change notification settings - Fork 191
60 lines (51 loc) · 1.88 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
name: Prepare release
on:
workflow_dispatch:
inputs:
version:
description: 'The version to release, e.g. 1.30.0'
required: true
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate version
run: |
version=${{ inputs.version }}
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "unexpected version: $version"
exit 1
fi
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Update schema files
run: |
if ! grep -q "^ next:$" schema-next.yaml; then
echo "String 'next:' not found in the file"
exit 1
fi
version=${{ inputs.version }}
sed -i "0,/^schema_url: .*\/next$/s/\/next$/\/$version/" schema-next.yaml
sed -i "0,/^ next:$/s// $version:/" schema-next.yaml
cp schema-next.yaml "schemas/$version"
git add "schemas/$version"
sed -i "0,/^ $version:$/s// next:\n $version:/" schema-next.yaml
- name: Update change log
run: |
make chlog-update VERSION=v${{ inputs.version }}
- name: Create pull request
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
version=${{ inputs.version }}
message="Prepare release v${version}"
body="Prepare release \`v${version}\`."
branch="opentelemetrybot/prepare-release-v${version}"
git checkout -b $branch
git commit -a -m "$message"
git push --set-upstream origin $branch
gh pr create --title "$message" \
--body "$body" \
--base main