diff --git a/.github/workflows/java-gradle-release.yaml b/.github/workflows/java-gradle-release.yaml index 71d9fac9c..96261bc4b 100644 --- a/.github/workflows/java-gradle-release.yaml +++ b/.github/workflows/java-gradle-release.yaml @@ -8,17 +8,6 @@ on: description: "Scope of the release (major, minor or patch)." required: true type: string - - gradle-cache: - description: "Whether Gradle caching is enabled or not. (Default is true)" - required: false - default: true - type: boolean - gradle-version: - description: "Gradle version to be installed. (Default is wrapper)" - required: false - type: string - default: "wrapper" java-distribution: description: "Java distribution to be installed. (Default is microsoft)" required: false @@ -29,6 +18,16 @@ on: required: false type: string default: "11" + gradle-version: + description: "Gradle version to be installed. (Default is wrapper)" + required: false + type: string + default: "wrapper" + gradle-cache: + description: "Whether Gradle caching is enabled or not. (Default is true)" + required: false + type: boolean + default: true working-directory: description: "Working directory of your Gradle artifacts. (Default is .)" required: false @@ -63,8 +62,7 @@ jobs: steps: - name: Release on Github id: release - uses: bakdata/ci-templates/actions/java-gradle-release@1.33.0 - # uses: bakdata/ci-templates/actions/java-gradle-release@feat/changelog-def + uses: bakdata/ci-templates/actions/java-gradle-release@1.27.0 with: release-type: ${{ inputs.release-type }} github-email: ${{ secrets.github-email }} diff --git a/actions/java-gradle-release/README.md b/actions/java-gradle-release/README.md index 67f1aa5c1..597b353e1 100644 --- a/actions/java-gradle-release/README.md +++ b/actions/java-gradle-release/README.md @@ -2,36 +2,20 @@ This action releases Java Gradle artifacts by createing a tag on GitHub. -## Dependencies - -This action uses the composite actions listed below: - -- [checkout](https://github.com/bakdata/ci-templates/tree/1.32.0/actions/checkout) -- [java-gradle-setup](https://github.com/bakdata/ci-templates/tree/v1.16.0/actions/java-gradle-setup) -- [bump-version](https://github.com/bakdata/ci-templates/tree/1.32.0/actions/bump-version) -- [changelog-generate](https://github.com/bakdata/ci-templates/tree/1.33.0/actions/changelog-generate) -- [commit-and-push](https://github.com/bakdata/ci-templates/tree/1.32.0/actions/commit-and-push) - ## Input Parameters | Name | Required | Default Value | Type | Description | | ----------------- | :------: | :-----------: | :-----: | ------------------------------------------------------------------------------------------------------------- | +| release-type | ✅ | - | string | Scope of the release | | 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 | -| changelog-file | ❌ | 11 | string | Path to the changelog file | -| gradle-cache | ❌ | true | boolean | Whether Gradle caching is enabled or not | -| gradle-version | ❌ | wrapper | string | [Gradle version](https://github.com/gradle/gradle-build-action#use-a-specific-gradle-version) to be installed | | 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 | +| gradle-version | ❌ | wrapper | string | [Gradle version](https://github.com/gradle/gradle-build-action#use-a-specific-gradle-version) to be installed | +| gradle-cache | ❌ | true | boolean | Whether Gradle caching is enabled or not | | working-directory | ❌ | "." | string | Working directory of your Gradle artifacts | -## Output Variables - -| Name | Description | -| --------------- | ---------------------------------- | -| release-version | The bumped version of your release | - ## Usage ```yaml @@ -39,6 +23,7 @@ steps: - name: Release on Github uses: bakdata/ci-templates/actions/java-gradle-release@main with: + release-type: "patch" github-email: ${{ secrets.github-email }} github-username: ${{ secrets.github-username }} github-token: ${{ secrets.github-token }} diff --git a/actions/java-gradle-release/action.yaml b/actions/java-gradle-release/action.yaml index 55ca21658..0d6ec7b86 100644 --- a/actions/java-gradle-release/action.yaml +++ b/actions/java-gradle-release/action.yaml @@ -2,31 +2,18 @@ name: "Release Java artifacts" description: "Release Java Gradle 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-token: - description: "GitHub token for requesting changes from API." - required: true github-username: description: "GitHub username for requesting changes from API." required: true - release-type: - description: "Scope of the release" + github-token: + description: "GitHub token for requesting changes from API." required: true - - changelog-file: - description: "Path to the changelog file" - required: false - default: "CHANGELOG.md" - gradle-cache: - description: "Whether Gradle caching is enabled or not. (Default is true)" - required: false - default: true - gradle-version: - description: "Gradle version to be installed. (Default is wrapper)" - required: false - default: "wrapper" java-distribution: description: "Java distribution to be installed. (Default is microsoft)" required: false @@ -35,6 +22,14 @@ inputs: description: "Java version to be installed. (Default is 11)" required: false default: "11" + gradle-version: + description: "Gradle version to be installed. (Default is wrapper)" + required: false + default: "wrapper" + gradle-cache: + description: "Whether Gradle caching is enabled or not. (Default is true)" + required: false + default: true working-directory: description: "Working directory of your Gradle artifacts. (Default is .)" required: false @@ -89,24 +84,19 @@ runs: - name: Create release run: ./gradlew release -x test -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ steps.evaluate-version.outputs.release-version }} -PdisablePushToRemote=true shell: bash - working-directory: ${{ inputs.working-directory }} + working-directory: ${{ inputs.working-directory }} - - name: Create changelog - id: build-changelog - # uses: bakdata/ci-templates/actions/changelog-generate@feat/changelog-def - uses: bakdata/ci-templates/actions/changelog-generate@1.33.0 - with: - github-token: ${{ inputs.github-token }} - new-tag: ${{ steps.evaluate-version.outputs.release-version }} - changelog-file: "${{ inputs.changelog-file }}" - fetch-reviewers: "true" - fetch-release-information: "true" + - name: Generate changelog + run: ./gradlew -Pchangelog.releaseVersion=${{ steps.evaluate-version.outputs.release-version }} --stacktrace --info generateChangelog + shell: bash + working-directory: ${{ inputs.working-directory }} + env: + GITHUB_USER: ${{ inputs.github-username }} + GITHUB_TOKEN: ${{ inputs.github-token }} - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@1.32.0 - with: - ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" - github-username: ${{ inputs.github-username }} - github-email: ${{ inputs.github-email }} - github-token: ${{ inputs.github-token }} + - name: Commit and push + run: | + git add CHANGELOG.md + git commit -m "Changelog for version ${{ steps.evaluate-version.outputs.release-version }}" + git push --follow-tags origin ${{ github.event.repository.default_branch }} + shell: bash