@@ -37,14 +37,56 @@ jobs:
3737 env :
3838 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3939 run : |
40- if [[ $VERSION != *-BETA* ]]
40+ if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4141 then
42- GA=" (GA)"
42+ opt_ga=" (GA)"
43+ else
44+ opt_prerelease="--prerelease"
4345 fi
4446 # TODO (trask) remove --draft after the first successful release using this script
4547 gh release create --target main \
46- --title "Version $VERSION$GA " \
48+ --title "Version $VERSION$opt_ga " \
4749 --notes-file /tmp/release-notes.txt \
50+ $opt_prerelease \
4851 --draft \
4952 $VERSION \
5053 applicationinsights-agent-$VERSION.jar
54+
55+ bump-version :
56+ runs-on : ubuntu-latest
57+ needs :
58+ - release
59+ steps :
60+ - uses : actions/checkout@v3
61+
62+ - name : Set environment variables
63+ run : |
64+ version=$(.github/scripts/get-version.sh)
65+ if [[ $version =~ ^([0-9]+\.[0-9]+)\.([0-9]+)$ ]]; then
66+ major_minor="${BASH_REMATCH[1]}"
67+ patch="${BASH_REMATCH[2]}"
68+ else
69+ echo "unexpected version: $version"
70+ exit 1
71+ fi
72+ echo "NEXT_VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
73+
74+ - name : Update version
75+ run : .github/scripts/update-version.sh $NEXT_VERSION
76+
77+ - name : Create pull request against main
78+ env :
79+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80+ run : |
81+ message="Update version to $NEXT_VERSION"
82+ body="Update version to \`$NEXT_VERSION\`."
83+ branch="automation/update-version-to-${NEXT_VERSION}"
84+
85+ git config user.name "github-actions[bot]"
86+ git config user.email "github-actions[bot]@users.noreply.github.com"
87+
88+ git checkout -b "$branch"
89+ git commit -a -m "$message"
90+ git push --set-upstream origin HEAD:$branch
91+ gh pr create --title "$message" \
92+ --body "$body"
0 commit comments