AutoMapper Prepare Release #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow prepares a new release by creating a pull request from 'develop' to 'main' | |
| name: AutoMapper Prepare Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'The version to release (e.g., 1.0.0)' | |
| required: true | |
| jobs: | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout develop branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: 'develop' | |
| - name: Create release branch from develop | |
| run: | | |
| git checkout -b "release/${{ github.event.inputs.version }}" | |
| - name: Update version in build files and README | |
| run: | | |
| VERSION=${{ github.event.inputs.version }} | |
| # Update version in processor/build.gradle.kts | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" automapper/processor/build.gradle.kts | |
| # Update version in annotation/build.gradle.kts | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" automapper/annotation/build.gradle.kts | |
| # Update dependency versions in README.md using a robust regex | |
| sed -i -r "s/(io\.github\.jacksever\.automapper:[^:]*:)[0-9]+\.[0-9]+\.[0-9]+(.*)/\1$VERSION\2/g" README.md | |
| - name: Commit and Push changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Prepare release of Kotlin AutoMapper ${{ github.event.inputs.version }}" | |
| git push -u origin "release/${{ github.event.inputs.version }}" | |
| - name: Create Pull Request to main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh pr create --base "main" --head "release/${{ github.event.inputs.version }}" --title "Prepare release of Kotlin AutoMapper ${{ github.event.inputs.version }}" --body "This PR integrates changes from `develop` into `main` for the ${{ github.event.inputs.version }} release" --reviewer "${{ github.actor }}" |