Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,13 @@ jobs:
break;
}
}

let commentBody = `Please update your pull request title to the required format:

**RegEx**
\`\`\`
${{ vars.PR_POLICY_TITLE_PATTERN }}
\`\`\`

**Simplified**
\`\`\`
<type>\[\!\]: <summary>
\`\`\`

* \`type\` - The type of pull request. This can be one of the following types:
* \`feat\` - An implementation of a feature; increments the Minor version unless suffixed with \`\!\`.
* \`fix\` - A general bugfix; increments the Patch version unless suffixed with \`\!\`.
* \`chore\` - Small maintance related task, typically something that doesn't affect the source code.
* \`ci\` - For tasks relating to GitHub workflows and some minor gradle adjustments that affect the CI process.
* \`docs\` - Documentation only changes.
* \`test\` - Used when adding missing tests or adjusting existing tests.
* \`\!\` - Indicates this PR includes breaking changes, necessitating an increment of the Major version regardless of \`type\`.
* \`summary\` - A short one line summary of the PR.

---

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build

on:
push:
branches: [ main, release/** ]
pull_request:
branches: [ main, release/** ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: CI

on:
push:
branches: [ main, release/** ]
pull_request:
branches: [ main, release/** ]

workflow_dispatch:

jobs:


test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build and Run Tests
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run tests with Maven
run: mvn -B test --file pom.xml
39 changes: 0 additions & 39 deletions .github/workflows/main.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ on:
pull_request:
branches:
- main
- releases/*
- release/**
types: [ opened, reopened, edited, synchronize ]

jobs:
check-pr:
uses: ./.github/workflows/.reusable-common-pr-check.yaml
uses: ./.github/workflows/.common-pr-check.yml
permissions:
pull-requests: write
147 changes: 147 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
type: string
description: Full version (major.minor.patch) number to release (example 1.2.3).
required: true
dry-run:
description: Dry run the release? Primary use is testing.
required: false
default: false

run-name: "Release: ${{ inputs.version }}"

jobs:
create-release:
env:
INTERNAL_REPO_URL: ${{ secrets.INTERNAL_REPO_URL }}
INTERNAL_REPO_USERNAME: ${{ secrets.INTERNAL_REPO_USERNAME }}
INTERNAL_REPO_PASSWORD: ${{ secrets.INTERNAL_REPO_PASSWORD }}
JAVA_VERSION: '17'

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Validate version input
shell: bash
run: |
echo "Validating release version: ${{ github.event.inputs.version }}"
if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Invalid version input. Must be of the format major.minor.patch (e.g. 2.16.0)."
exit 1
fi

- name: Checkout Source
uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven

- name: Create Maven settings.xml
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<EOF
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>internal-repo</id>
<username>${INTERNAL_REPO_USERNAME}</username>
<password>${INTERNAL_REPO_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>internal</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>internal-repo</id>
<url>${INTERNAL_REPO_URL}</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>internal-repo</id>
<url>${INTERNAL_REPO_URL}</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
EOF

- name: Deploy
if: ${{ github.event.inputs.dry-run != 'true' }}
run: mvn clean deploy -s ~/.m2/settings.xml

- name: Does Tag Exist?
id: check_tag_exists
run: |
TAG="${{ github.event.inputs.version }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Skipping tagging."
else
echo "should_tag=true" >> $GITHUB_OUTPUT
fi

- name: Create Tag
if: steps.check_tag_exists.outputs.should_tag
id: create_tag
run: |
TAG="${{ github.event.inputs.version }}"
git tag $TAG
git push origin $TAG

echo "TAG=$TAG" >> $GITHUB_OUTPUT

- name: Build Changelog
id: changelog
if: steps.check_tag_exists.outputs.should_tag
run: |
CURRENT_TAG=${{ steps.create_tag.outputs.TAG }}

# Get the previous tag (sorted by commit date, excluding current tag)
PREV_TAG=$(git tag --sort=-committerdate | grep -v "$CURRENT_TAG" | head -n 1)

# If no previous tag exists, use the first commit
if [ -z "$PREV_TAG" ]; then
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
fi

# Get commit messages between the previous and current tag
CHANGELOG=$(git log --pretty="- %s (%h)" $PREV_TAG..$CURRENT_TAG)

# Write changelog to environment file
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Create Release in GitHub
if: steps.check_tag_exists.outputs.should_tag
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.create_tag.outputs.TAG }}
name: "Release ${{ steps.create_tag.outputs.TAG }}"
body: |
## Release ${{ steps.create_tag.outputs.TAG }}

### Changes
${{ env.CHANGELOG }}
draft: false
prerelease: false