prepare-patch-release.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
  12. if [[ $prior_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: $prior_version"
  17. exit 1
  18. fi
  19. echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
  20. echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
  21. - name: Bump version
  22. run: |
  23. .github/scripts/update-versions.sh "$PRIOR_VERSION" "$PRIOR_VERSION-alpha" "$VERSION" "$VERSION-alpha"
  24. - name: Bump download link version
  25. run: |
  26. sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$PRIOR_VERSION/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md
  27. - name: Set git user
  28. run: |
  29. git config user.name opentelemetry-java-bot
  30. git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
  31. - name: Create pull request
  32. env:
  33. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  34. run: |
  35. msg="Prepare release $VERSION"
  36. git commit -a -m "$msg"
  37. git push origin HEAD:prepare-release-$VERSION
  38. gh pr create --title "[$GITHUB_REF_NAME] $msg" \
  39. --body "$msg" \
  40. --head prepare-release-$VERSION \
  41. --base $GITHUB_REF_NAME