diff --git a/.github/workflows/java-gradle-docker.yaml b/.github/workflows/java-gradle-docker.yaml index 13b313859..0c12911f5 100644 --- a/.github/workflows/java-gradle-docker.yaml +++ b/.github/workflows/java-gradle-docker.yaml @@ -72,9 +72,6 @@ on: docker-password: description: "Password for publishing to Dockerhub." 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 @@ -162,12 +159,13 @@ jobs: steps: - name: Release on Github - uses: bakdata/ci-templates/actions/java-gradle-release-github@v1.16.0 + uses: bakdata/ci-templates/actions/java-gradle-release-github@1.43.0 with: - github-username: ${{ secrets.github-username }} github-token: ${{ secrets.github-token }} java-distribution: ${{ inputs.java-distribution }} java-version: ${{ inputs.java-version }} gradle-version: ${{ inputs.gradle-version }} gradle-cache: ${{ inputs.gradle-cache }} + gradle-cache-read-only: true + gradle-refresh-dependencies: ${{ inputs.gradle-refresh-dependencies }} working-directory: ${{ inputs.working-directory }} diff --git a/.github/workflows/java-gradle-library.yaml b/.github/workflows/java-gradle-library.yaml index 40dd6ff57..96312792a 100644 --- a/.github/workflows/java-gradle-library.yaml +++ b/.github/workflows/java-gradle-library.yaml @@ -62,9 +62,6 @@ on: ossrh-password: description: "Password for signing into Sonatype repository." 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 @@ -123,12 +120,13 @@ jobs: steps: - name: Release on Github - uses: bakdata/ci-templates/actions/java-gradle-release-github@v1.16.0 + uses: bakdata/ci-templates/actions/java-gradle-release-github@1.43.0 with: - github-username: ${{ secrets.github-username }} github-token: ${{ secrets.github-token }} java-distribution: ${{ inputs.java-distribution }} java-version: ${{ inputs.java-version }} gradle-version: ${{ inputs.gradle-version }} gradle-cache: ${{ inputs.gradle-cache }} + gradle-cache-read-only: true + gradle-refresh-dependencies: ${{ inputs.gradle-refresh-dependencies }} working-directory: ${{ inputs.working-directory }} diff --git a/.github/workflows/java-gradle-plugin.yaml b/.github/workflows/java-gradle-plugin.yaml index c38bb774d..df7db31f7 100644 --- a/.github/workflows/java-gradle-plugin.yaml +++ b/.github/workflows/java-gradle-plugin.yaml @@ -68,9 +68,6 @@ on: gradle-publish-secret: description: "Secret for publishing to Gradle Plugin Portal." 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 @@ -151,12 +148,13 @@ jobs: steps: - name: Release on Github - uses: bakdata/ci-templates/actions/java-gradle-release-github@v1.16.0 + uses: bakdata/ci-templates/actions/java-gradle-release-github@1.43.0 with: - github-username: ${{ secrets.github-username }} github-token: ${{ secrets.github-token }} java-distribution: ${{ inputs.java-distribution }} java-version: ${{ inputs.java-version }} gradle-version: ${{ inputs.gradle-version }} gradle-cache: ${{ inputs.gradle-cache }} + gradle-cache-read-only: true + gradle-refresh-dependencies: ${{ inputs.gradle-refresh-dependencies }} working-directory: ${{ inputs.working-directory }} diff --git a/.github/workflows/java-gradle-release.yaml b/.github/workflows/java-gradle-release.yaml index 529d5b8d4..29354d691 100644 --- a/.github/workflows/java-gradle-release.yaml +++ b/.github/workflows/java-gradle-release.yaml @@ -71,7 +71,6 @@ jobs: uses: bakdata/ci-templates/actions/java-gradle-release@1.43.0 with: release-type: ${{ inputs.release-type }} - changelog-file: "${{ inputs.changelog-file }}" github-email: ${{ secrets.github-email }} github-username: ${{ secrets.github-username }} github-token: ${{ secrets.github-token }} diff --git a/actions/java-gradle-release-github/action.yaml b/actions/java-gradle-release-github/action.yaml index 6c42a2dc5..20e7e916d 100644 --- a/actions/java-gradle-release-github/action.yaml +++ b/actions/java-gradle-release-github/action.yaml @@ -2,18 +2,44 @@ name: "Release Java artifacts" description: "Release Java Gradle artifacts on Github" inputs: - changelog-file: - description: Path to the changelog file in the GitHub repository - required: false - default: "CHANGELOG.md" 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" + 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 + gradle-cache-read-only: + description: "Whether Gradle caching should be read-only. By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches." + required: false + default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }} + gradle-refresh-dependencies: + description: "Whether Gradle should refresh dependencies. (Default is false)" + required: false + default: "false" + working-directory: + description: "Working directory of your Gradle artifacts. (Default is .)" + required: false + default: "." runs: using: "composite" steps: - name: Check out repository uses: bakdata/ci-templates/actions/checkout@1.32.0 + with: + fetch-depth: 0 - name: Download build artifact uses: actions/download-artifact@v3 @@ -21,17 +47,25 @@ runs: name: build-artifact path: build - - name: Create changelog - id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.38.0 + - name: Set up Gradle with version ${{ inputs.gradle-version }} + uses: bakdata/ci-templates/actions/java-gradle-setup@1.42.0 with: - github-token: ${{ inputs.github-token }} - new-tag: ${GITHUB_REF##*/} - changelog-file: "${{ inputs.changelog-file }}" - fetch-release-information: "true" + java-distribution: ${{ inputs.java-distribution }} + java-version: ${{ inputs.java-version }} + gradle-version: ${{ inputs.gradle-version }} + gradle-cache: ${{ inputs.gradle-cache }} + gradle-cache-read-only: ${{ inputs.gradle-cache-read-only }} + + - name: Generate changelog + run: ./gradlew -Pchangelog.githubRepository=${{ github.event.repository.name }} -Pchangelog.futureVersionTag=${{ github.ref_name }} -Pchangelog.sinceTag=${{ github.ref_name }} --stacktrace --info generateChangelog ${{ inputs.gradle-refresh-dependencies && '--refresh-dependencies' || '' }} + shell: bash + working-directory: ${{ inputs.working-directory }} + env: + GITHUB_USER: ${{ github.repository_owner }} + GITHUB_TOKEN: ${{ inputs.github-token }} - name: Create Github release uses: softprops/action-gh-release@v1 with: body_path: CHANGELOG.md - files: ./build/**/*.jar + files: "**/build/libs/*.jar" diff --git a/actions/java-gradle-release/action.yaml b/actions/java-gradle-release/action.yaml index 948506f8e..1090b151d 100644 --- a/actions/java-gradle-release/action.yaml +++ b/actions/java-gradle-release/action.yaml @@ -14,10 +14,6 @@ inputs: github-token: description: "GitHub token for requesting changes from API." required: true - changelog-file: - description: Path to the changelog file in the GitHub repository - required: false - default: "CHANGELOG.md" gradle-cache: description: "Whether Gradle caching is enabled or not. (Default is true)" required: false @@ -99,14 +95,18 @@ runs: shell: bash working-directory: ${{ inputs.working-directory }} + - name: Push release tag + run: | + git push --tags origin + shell: bash + - name: Create changelog - id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.38.0 - with: - github-token: ${{ inputs.github-token }} - new-tag: ${{ steps.evaluate-version.outputs.release-version }} - changelog-file: "${{ inputs.changelog-file }}" - fetch-release-information: "true" + run: ./gradlew -Pchangelog.githubRepository=${{ github.event.repository.name }} -Pchangelog.futureVersionTag=${{ steps.evaluate-version.outputs.release-version }} --stacktrace --info generateChangelog ${{ inputs.gradle-refresh-dependencies && '--refresh-dependencies' || '' }} + shell: bash + working-directory: ${{ inputs.working-directory }} + env: + GITHUB_USER: ${{ github.repository_owner }} + GITHUB_TOKEN: ${{ inputs.github-token }} - name: Commit and push changes including the bump config file run: | diff --git a/docs/actions/java-gradle-release-github/README.md b/docs/actions/java-gradle-release-github/README.md index 2461ada48..3403cda6d 100644 --- a/docs/actions/java-gradle-release-github/README.md +++ b/docs/actions/java-gradle-release-github/README.md @@ -23,10 +23,16 @@ steps: -| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | -| -------------- | ------ | -------- | ---------------- | --------------------------------------------------- | -| changelog-file | string | false | `"CHANGELOG.md"` | Path to the changelog file in the GitHub repository | -| github-token | string | true | | GitHub token for requesting changes from API. | +| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | +| --------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| github-token | string | true | | GitHub token for requesting changes from API. | +| gradle-cache | string | false | `"true"` | Whether Gradle caching is enabled or not. (Default is true) | +| gradle-cache-read-only | string | false | `"${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}"` | Whether Gradle caching should be read-only. By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches. | +| gradle-refresh-dependencies | string | false | `"false"` | Whether Gradle should refresh dependencies. (Default is false) | +| gradle-version | string | false | `"wrapper"` | Gradle version to be installed. (Default is wrapper) | +| java-distribution | string | false | `"microsoft"` | Java distribution to be installed. (Default is microsoft) | +| java-version | string | false | `"11"` | Java version to be installed. (Default is 11) | +| working-directory | string | false | `"."` | Working directory of your Gradle artifacts. (Default is .) | diff --git a/docs/actions/java-gradle-release/README.md b/docs/actions/java-gradle-release/README.md index 4882b46a5..6e17fa569 100644 --- a/docs/actions/java-gradle-release/README.md +++ b/docs/actions/java-gradle-release/README.md @@ -28,7 +28,6 @@ steps: | INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | | --------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| changelog-file | string | false | `"CHANGELOG.md"` | Path to the changelog file in the GitHub repository | | github-email | string | true | | GitHub email for requesting changes from API. | | github-token | string | true | | GitHub token for requesting changes from API. | | github-username | string | true | | GitHub username for requesting changes from API. | diff --git a/docs/workflows/java-gradle-docker/README.md b/docs/workflows/java-gradle-docker/README.md index 037d08b31..3ab65b717 100644 --- a/docs/workflows/java-gradle-docker/README.md +++ b/docs/workflows/java-gradle-docker/README.md @@ -88,7 +88,6 @@ No outputs. | docker-password | true | Password for publishing to Dockerhub. | | docker-username | true | Username for publishing to Dockerhub. | | github-token | true | GitHub token for requesting changes from API. | -| github-username | true | GitHub username for requesting changes from API. | | ossrh-password | true | Password for signing into Sonatype repository. | | ossrh-username | true | Username for signing into Sonatype repository. | | signing-key-id | true | Key id for signing the Sonatype publication. | diff --git a/docs/workflows/java-gradle-library/README.md b/docs/workflows/java-gradle-library/README.md index 018d28a83..c11d8d7bd 100644 --- a/docs/workflows/java-gradle-library/README.md +++ b/docs/workflows/java-gradle-library/README.md @@ -80,7 +80,6 @@ No outputs. | SECRET | REQUIRED | DESCRIPTION | | ----------------------- | -------- | --------------------------------------------------------------- | | github-token | true | GitHub token for requesting changes from API. | -| github-username | true | GitHub username for requesting changes from API. | | ossrh-password | true | Password for signing into Sonatype repository. | | ossrh-username | true | Username for signing into Sonatype repository. | | signing-key-id | true | Key id for signing the Sonatype publication. | diff --git a/docs/workflows/java-gradle-plugin/README.md b/docs/workflows/java-gradle-plugin/README.md index 58ed64107..d0167cc07 100644 --- a/docs/workflows/java-gradle-plugin/README.md +++ b/docs/workflows/java-gradle-plugin/README.md @@ -84,7 +84,6 @@ No outputs. | SECRET | REQUIRED | DESCRIPTION | | ----------------------- | -------- | --------------------------------------------------------------- | | github-token | true | GitHub token for requesting changes from API. | -| github-username | true | GitHub username for requesting changes from API. | | gradle-publish-key | true | Key for publishing to Gradle Plugin Portal. | | gradle-publish-secret | true | Secret for publishing to Gradle Plugin Portal. | | ossrh-password | true | Password for signing into Sonatype repository. |