diff --git a/.github/release-notes.yml b/.github/release-notes.yml deleted file mode 100644 index 74535a00..00000000 --- a/.github/release-notes.yml +++ /dev/null @@ -1,20 +0,0 @@ -releasenotes: - sections: - - title: "Headliners" - emoji: ":star:" - labels: [ "headliner" ] - - title: "New Features" - emoji: ":gift:" - labels: [ "feature" ] - - title: "Enhancements" - emoji: ":sparkles:" - labels: [ "enhancement" ] - - title: "Bugs Fixed" - emoji: ":beetle:" - labels: [ "bug" ] - - title: "Documentation" - emoji: ":book:" - labels: "documentation" - - title: "Automation" - emoji: ":robot:" - labels: [ "automation" ] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..d30df62a --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,23 @@ +changelog: + categories: + - title: Headliners + labels: + - headliner + - title: New Features + labels: + - feature + - title: Enhancements + labels: + - enhancement + - title: Bugs Fixed + labels: + - bug + - title: Documentation + labels: + - documentation + - title: Automation + labels: + - automation + - title: Other changes + labels: + - "*" diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index b77134f7..be0d78f4 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -14,18 +14,18 @@ jobs: env: MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.m2/repository @@ -43,4 +43,4 @@ jobs: run: mvn -B -q spotless:check - name: Upload Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 diff --git a/.github/workflows/create-hotfix-branch.yaml b/.github/workflows/create-hotfix-branch.yaml index 413db952..ead9da2d 100644 --- a/.github/workflows/create-hotfix-branch.yaml +++ b/.github/workflows/create-hotfix-branch.yaml @@ -29,12 +29,12 @@ jobs: - name: Get latest tag if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-get-latest-tag@v1 + run: echo "LATEST_TAG= $(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV id: get-latest-tag - name: Format latest tag if: ${{ !github.event.inputs.version }} - run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV + run: echo "CURRENT_VERSION=$(echo ${{ env.LATEST_TAG }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index d5bad21c..f9133ffc 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -1,11 +1,9 @@ name: Create Release Branch on: - workflow_dispatch: - inputs: - version: - description: 'Release Branch Version' - required: false + milestone: + types: + - closed env: artifactId: koryphe @@ -23,25 +21,8 @@ jobs: token: ${{ secrets.ADMIN_GITHUB_TOKEN }} fetch-depth: 0 - - name: Set version from input - if: ${{ github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ github.event.inputs.version }} | sed 's/^v//')" >> $GITHUB_ENV - - - name: Get latest tag - if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - - name: Format latest tag - if: ${{ !github.event.inputs.version }} - run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - - - name: Bump latest tag variable version - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.$((\2+1)).0/' | sh)" >> $GITHUB_ENV - - - name: Verify version regex - run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + - name: Set version from milestone + run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }})" >> $GITHUB_ENV - name: Set release branch run: echo "BRANCH_NAME=$(echo release/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV @@ -60,3 +41,14 @@ jobs: git checkout -b $BRANCH_NAME git commit -a -m "prepare release $artifactId-$RELEASE_VERSION" git push --set-upstream origin $BRANCH_NAME + + - name: Tag release branch + run: | + git tag koryphe-$RELEASE_VERSION + git push origin --tags + + - name: Create PR to master + run: | + gh pr create -B master -H $BRANCH_NAME --title 'Merge release into master branch' --body 'Created by GH Action' + env: + GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} diff --git a/.github/workflows/release-standalone.yaml b/.github/workflows/release-standalone.yaml index 73d67182..54e41f13 100644 --- a/.github/workflows/release-standalone.yaml +++ b/.github/workflows/release-standalone.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '8' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dcd31d57..cb9e7c9a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,25 +1,26 @@ name: Release on: - milestone: - types: - - closed + pull_request: + branches: + - master + types: [closed] env: artifactId: koryphe MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 - jobs: - create-release-tag: + deploy-release: + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest outputs: - branch_name: ${{ steps.branch.outputs.branch_name }} + release_version: ${{ steps.release-version.outputs.release_version }} steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' @@ -36,111 +37,18 @@ jobs: git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - name: Set release version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV - - - name: Set branch name - run: echo "BRANCH_NAME=$(git branch -a | grep $RELEASE_VERSION | tail -n 1 | cut -c 18-)" >> $GITHUB_ENV - - - name: Output branch name - id: branch - run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - - - name: Fail if no branch found - if: ${{ !env.BRANCH_NAME }} - run: exit 1 - - - name: Checkout master - uses: actions/checkout@v4 - with: - ref: master - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Merge release into master - run: | - git checkout ${{ env.BRANCH_NAME }} - git checkout master - git merge ${{ env.BRANCH_NAME }} - - - name: Push changes + - name: Output release version + id: release-version run: | - git tag $artifactId-$RELEASE_VERSION - git push origin $artifactId-$RELEASE_VERSION - git push - - update-develop: - runs-on: ubuntu-latest - needs: - - create-release-tag - - steps: - - name: Checkout develop - uses: actions/checkout@v4 - with: - ref: develop - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Set up Github credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - - name: Setup JDK - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '11' - - - name: Merge release into develop - run: | - git checkout ${{ needs.create-release-tag.outputs.branch_name }} - git checkout develop - git merge ${{ needs.create-release-tag.outputs.branch_name }} --strategy-option theirs - - - name: Update development branch - run: | - git checkout develop - mvn release:update-versions -B - git commit -a -m "prepare for next development iteration" - git push - - update-github-releases: - runs-on: ubuntu-latest - needs: - - create-release-tag - - steps: - - name: Checkout Master - uses: actions/checkout@v4 - with: - ref: master - - - name: Create Release Notes - uses: docker://decathlon/release-notes-generator-action:2.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Set version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV - - - name: Upload notes - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }} - name: Koryphe ${{ env.RELEASE_VERSION }} - body_path: release_file.md + echo "release_version=$(mvn -q help:evaluate -DforceStdout -Dexpression=pom.version)" >> $GITHUB_OUTPUT generate-javadoc: runs-on: ubuntu-latest needs: - - create-release-tag + - deploy-release steps: - - name: Checkout Master + - name: Checkout master uses: actions/checkout@v4 with: ref: master @@ -158,7 +66,7 @@ jobs: java-version: '11' - name: Set version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV - name: Upload Javadoc run: | @@ -177,11 +85,11 @@ jobs: release-to-nexus: runs-on: ubuntu-latest needs: - - create-release-tag + - deploy-release steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' @@ -207,3 +115,60 @@ jobs: OSS_NEXUS_USERNAME: ${{ secrets.OSS_NEXUS_USERNAME }} OSS_NEXUS_PASSWORD: ${{ secrets.OSS_NEXUS_PASSWORD }} run: mvn deploy -P quick,ossrh-release --settings cd/mvnsettings.xml -B + + update-github-releases: + runs-on: ubuntu-latest + needs: + - deploy-release + + steps: + - name: Checkout Master + uses: actions/checkout@v4 + with: + ref: master + + - name: Set version + run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV + + - name: Create release notes + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }} + name: Koryphe ${{ env.RELEASE_VERSION }} + + update-develop: + runs-on: ubuntu-latest + needs: + - deploy-release + + steps: + - name: Checkout develop + uses: actions/checkout@v4 + with: + ref: develop + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Set up Github credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '11' + + - name: Merge master into develop + run: | + git merge origin/master + + - name: Update develop branch + run: | + git checkout develop + mvn release:update-versions -B + git commit -a -m "prepare for next development iteration" + git push