-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf8e38
commit f2bf20e
Showing
3 changed files
with
111 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# java-maven-release | ||
|
||
This action releases Java Maven artifacts by createing a tag on GitHub. | ||
|
||
## Input Parameters | ||
|
||
| Name | Required | Default Value | Type | Description | | ||
| ----------------- | :------: | :-----------: | :----: | -------------------------------------------------------------------------------------------------- | | ||
| github-email | ✅ | - | string | GitHub email for requesting changes from API | | ||
| github-username | ✅ | - | string | GitHub username for requesting changes from API | | ||
| github-token | ✅ | - | string | GitHub token for requesting changes from API | | ||
| java-distribution | ❌ | microsoft | string | [Java distribution](https://github.com/actions/setup-java#supported-distributions) to be installed | | ||
| java-version | ❌ | 11 | string | Java version to be installed | | ||
| working-directory | ❌ | "." | string | Working directory of your Maven artifacts | | ||
|
||
## Usage | ||
|
||
```yaml | ||
steps: | ||
- name: Release on Github | ||
uses: bakdata/ci-templates/actions/java-maven-release@main | ||
with: | ||
github-email: ${{ secrets.github-email }} | ||
github-username: ${{ secrets.github-username }} | ||
github-token: ${{ secrets.github-token }} | ||
java-distribution: "microsoft" # (Optional) | ||
java-version: "11" # (Optional) | ||
working-directory: "." # (Optional) | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: "Release Java artifacts" | ||
description: "Release Java Maven artifacts on Github" | ||
|
||
inputs: | ||
release-type: | ||
description: "Scope of the release" | ||
required: true | ||
github-email: | ||
description: "GitHub email for requesting changes from API." | ||
required: true | ||
github-username: | ||
description: "GitHub username for requesting changes from API." | ||
required: true | ||
github-token: | ||
description: "GitHub token for requesting changes from API." | ||
required: true | ||
java-distribution: | ||
description: "Java distribution to be installed. (Default is microsoft)" | ||
required: false | ||
default: "microsoft" | ||
java-version: | ||
description: "Java version to be installed. (Default is 11)" | ||
required: false | ||
default: "11" | ||
working-directory: | ||
description: "Working directory of your Maven artifacts. (Default is .)" | ||
required: false | ||
default: "." | ||
|
||
outputs: | ||
release-version: | ||
description: "The bumped version of your release." | ||
value: ${{ steps.evaluate-version.outputs.release-version }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check out repository | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ inputs.github-token }} | ||
|
||
- name: Setup git | ||
run: | | ||
git config user.email ${{ inputs.github-email }} | ||
git config user.name ${{ inputs.github-username }} | ||
shell: bash | ||
|
||
- name: Setup semver | ||
run: | | ||
wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/3.3.0/src/semver | ||
chmod +x /usr/local/bin/semver | ||
shell: bash | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: ${{ inputs.java-distribution }} | ||
java-version: ${{ inputs.java-version }} | ||
|
||
- name: Bump version | ||
id: evaluate-version | ||
run: | | ||
old_version=$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q) | ||
if [[ "${{ inputs.release-type }}" == "patch" ]]; then | ||
release_version="${old_version%-*}" | ||
else | ||
release_version=$(semver bump "${{ inputs.release-type }}" "${old_version}") | ||
fi | ||
echo "release-version=$release_version" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
||
- name: Create release | ||
run: mvn release:prepare -B -DreleaseVersion=${{ steps.evaluate-version.outputs.release-version }} -Darguments=-DskipTests -Dscm.developer.connection="scm:git:${{ github.server_url }}/${{ github.repository }}.git" | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} |