123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- name: Prepare release branch
- on:
- workflow_dispatch:
- jobs:
- create-pull-request-against-release-branch:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Create release branch
- id: create-release-branch
- run: |
- version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
- release_branch_name=$(echo $version | sed -E 's,([0-9]+)\.([0-9]+)\.0,release/v\1.\2.x,')
- git push origin HEAD:$release_branch_name
- echo "VERSION=$version" >> $GITHUB_ENV
- echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- - name: Update version
- run: |
- sed -ri "s/val snapshot = true/val snapshot = false/" version.gradle.kts
- version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
- .github/scripts/update-examples.sh "$version"
- - name: Update download link version
- run: |
- version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
- sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/," README.md
- - name: Set git user
- run: |
- git config user.name opentelemetry-java-bot
- git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- - name: Create pull request against the release branch
- env:
- GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- run: |
- message="Prepare release $VERSION"
- branch=prepare-release-$VERSION
- git commit -a -m "$message"
- git push origin HEAD:$branch
- gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
- --body "$message." \
- --head $branch \
- --base $RELEASE_BRANCH_NAME
- create-pull-request-against-main:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Update version
- run: |
- version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
- if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
- major="${BASH_REMATCH[1]}"
- minor="${BASH_REMATCH[2]}"
- else
- echo "unexpected version: $version"
- exit 1
- fi
- next_version="$major.$((minor + 1)).0"
- sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$next_version/" version.gradle.kts
- .github/scripts/update-examples.sh "$next_version-SNAPSHOT"
- echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV
- - name: Set git user
- run: |
- git config user.name opentelemetry-java-bot
- git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
- - name: Create pull request against main
- env:
- GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- run: |
- message="Update version to $NEXT_VERSION-SNAPSHOT"
- body="Update version to \`$NEXT_VERSION-SNAPSHOT\`."
- branch=update-version-to-$NEXT_VERSION-snapshot
- git commit -a -m "$message"
- git push origin HEAD:$branch
- gh pr create --title "$message" \
- --body "$body" \
- --head $branch \
- --base main
|