prepare-patch-release.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Prepare patch release
  2. on:
  3. workflow_dispatch:
  4. jobs:
  5. prepare-patch-release:
  6. runs-on: ubuntu-latest
  7. steps:
  8. - uses: actions/checkout@v3
  9. - name: Set environment variables
  10. run: |
  11. version=$(.github/scripts/get-version.sh)
  12. if [[ $version =~ ([0-9]+\.[0-9]+)\.([0-9]+) ]]; then
  13. major_minor="${BASH_REMATCH[1]}"
  14. patch="${BASH_REMATCH[2]}"
  15. else
  16. echo "unexpected version: $version"
  17. exit 1
  18. fi
  19. echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
  20. - name: Update version
  21. run: .github/scripts/update-version.sh $VERSION ${VERSION}-alpha
  22. - name: Update download link version
  23. run: |
  24. sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v[0-9]+\.[0-9]+\.[0-9]+/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md
  25. - name: Set git user
  26. run: .github/scripts/set-git-user.sh
  27. - name: Create pull request
  28. env:
  29. # not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
  30. GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
  31. run: |
  32. message="Prepare release $VERSION"
  33. branch="prepare-release-${VERSION}"
  34. git commit -a -m "$message"
  35. git push origin HEAD:$branch
  36. gh pr create --title "[$GITHUB_REF_NAME] $message" \
  37. --body "$message." \
  38. --head $branch \
  39. --base $GITHUB_REF_NAME