|
| 1 | +name: Post Release - Prepare Main for Next Development Cycle |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version number (e.g., 1.0.1)' |
| 8 | + required: true |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + prepare-main: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Setup Git |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Configure Git |
| 24 | + run: | |
| 25 | + git config user.name "github-actions" |
| 26 | + git config user.email "[email protected]" |
| 27 | +
|
| 28 | + - name: Extract Major.Minor Version and setup Env variable |
| 29 | + run: | |
| 30 | + echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV |
| 31 | + echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV |
| 32 | +
|
| 33 | + - name: Determine release branch and checkout |
| 34 | + run: | |
| 35 | + RELEASE_BRANCH="release/${MAJOR_MINOR}.x" |
| 36 | + git fetch origin $RELEASE_BRANCH |
| 37 | + git checkout -b "prepare-main-for-next-dev-cycle-${VERSION}" origin/$RELEASE_BRANCH |
| 38 | +
|
| 39 | + - name: Update version to next development version in main |
| 40 | + run: | |
| 41 | + DEV_VERSION="${{ github.event.inputs.version }}.dev0" |
| 42 | + sed -i 's/__version__ = ".*"/__version__ = "'$DEV_VERSION'"/' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py |
| 43 | + git add aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py |
| 44 | + git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION" |
| 45 | + git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}" |
| 46 | +
|
| 47 | + - name: Create Pull Request to main |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + run: | |
| 51 | + DEV_VERSION="${{ github.event.inputs.version }}.dev0" |
| 52 | + gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \ |
| 53 | + --body "This PR prepares the main branch for the next development cycle by updating the version to $DEV_VERSION. |
| 54 | + |
| 55 | + This PR should only be merge when release for version v$VERSION is success. |
| 56 | + |
| 57 | + By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \ |
| 58 | + --head prepare-main-for-next-dev-cycle-${VERSION} \ |
| 59 | + --base main |
0 commit comments