forked from open-telemetry/semantic-conventions
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (81 loc) · 3.5 KB
/
Copy pathpost-release.yml
File metadata and controls
90 lines (81 loc) · 3.5 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
name: Post-release
on:
release:
types: [published]
permissions:
contents: read
jobs:
bump-schema-url:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'open-telemetry' }}
permissions:
contents: write # required for pushing changes
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
# zizmor: ignore[artipacked] Credentials are required by the branch push below.
persist-credentials: true
# only bump the development schema_url for minor/major releases,
# patch releases are cut from a release branch and don't move main forward.
# skip flag is controlling this
- name: Compute next development version
id: version
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
tag="${GITHUB_EVENT_RELEASE_TAG_NAME}"
version="${tag#v}"
if [[ ! "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "unexpected release version: $version"
exit 1
fi
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
if [[ "$patch" != "0" ]]; then
echo "patch release $version, skipping schema_url bump"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
next_version="$major.$((minor + 1)).0-unreleased"
echo "next_version=$next_version" >> "$GITHUB_OUTPUT"
- name: Use CLA approved github bot
if: ${{ steps.version.outputs.skip != 'true' }}
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Bump schema_url in manifest
if: ${{ steps.version.outputs.skip != 'true' }}
env:
STEPS_VERSION_OUTPUTS_NEXT_VERSION: ${{ steps.version.outputs.next_version }}
run: |
next_version="${STEPS_VERSION_OUTPUTS_NEXT_VERSION}"
sed -i "s|^schema_url: https://opentelemetry.io/schemas/.*$|schema_url: https://opentelemetry.io/schemas/$next_version|" model/manifest.yaml
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
if: ${{ steps.version.outputs.skip != 'true' }}
id: otelbot-token
with:
client-id: ${{ vars.OTELBOT_CLIENT_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
permission-pull-requests: write
- name: Create pull request
if: ${{ steps.version.outputs.skip != 'true' }}
env:
# Use the App token for PR creation so the pull request runs workflows.
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
VERSION: ${{ github.event.release.tag_name }}
NEXT_VERSION: ${{ steps.version.outputs.next_version }}
run: |
message="[chore] Bump development schema_url to ${NEXT_VERSION}"
body="Post-release update for \`${VERSION}\`: bump \`model/manifest.yaml\` schema_url to \`https://opentelemetry.io/schemas/${NEXT_VERSION}\`."
branch="otelbot/bump-schema-url-${NEXT_VERSION}"
git checkout -b "$branch"
if git diff --quiet; then
echo "No changes to commit; schema_url already up to date."
exit 0
fi
git commit -a -m "$message"
git push --set-upstream origin "$branch"
gh pr create --title "$message" \
--body "$body" \
--head "$branch" \
--base main