diff --git a/.github/workflows/release_new.yml b/.github/workflows/release_new.yml new file mode 100644 index 00000000..4ec5f9ed --- /dev/null +++ b/.github/workflows/release_new.yml @@ -0,0 +1,71 @@ +name: Master release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: 'Release and tag version (ie 5.5.0)' + required: true + developmentVersion: + description: 'Next development version, with SNAPSHOT' + required: true + +jobs: + master_release: + if: "!contains(github.event.head_commit.message, '[maven-release-plugin]')" + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + attestations: write + id-token: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # Fetch all history for all tags and branches + fetch-depth: 0 + # Use PAT instead of the default GITHUB_TOKEN for authentication + token: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + + - name: Initialize mandatory git config + run: | + git config user.name "GitHub Actions" + git config user.email noreply@github.com + + - name: Configure Git HTTPS authentication + run: | + git config --global url."https://${{ secrets.GH_PACKAGE_REPO_PASSWORD }}@github.com/".insteadOf "git@github.com:" + git remote set-url origin https://${{ secrets.GH_PACKAGE_REPO_PASSWORD }}@github.com/${{ github.repository }}.git + + - name: Release with Maven + env: + GITHUB_USERNAME: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_PACKAGE_REPO_PASSWORD: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} + run: | + mvn -B -Dtag=${{ github.event.inputs.releaseVersion }} release:prepare \ + -DreleaseVersion=${{ github.event.inputs.releaseVersion }} \ + -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} --file pom.xml \ + && mvn release:perform -B --file pom.xml + + - name: Create A Pull Request + uses: thomaseizinger/create-pull-request@1.3.0 + with: + github_token: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} + head: master + base: develop + title: Released master into develop + body: | + Hi! + This PR was created in response workflow running. + I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.