Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh-236: Update GH actions #327

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/release-notes.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -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:
- "*"
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,4 +43,4 @@ jobs:
run: mvn -B -q spotless:check

- name: Upload Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
4 changes: 2 additions & 2 deletions .github/workflows/create-hotfix-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
40 changes: 16 additions & 24 deletions .github/workflows/create-release-branch.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check, as the previous releases were tagged, I'm guessing that used to be done using the steps above which have been removed?

Copy link
Member

@tb06904 tb06904 Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tags must have been applied manually the removed steps don't seem to have done any tagging they just worked out the version. The tagging was previously done by the release.yaml by the looks of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall them being applied manually - which is why I'd commented, but as you say there doesn't appear have been anything which did this. In any case, as it is now there won't be any other steps which could apply tags beyonf this one, so this should be fine.

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 }}
2 changes: 1 addition & 1 deletion .github/workflows/release-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
181 changes: 73 additions & 108 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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'
Expand All @@ -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
Loading