diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 395779a6e..06504975e 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -532,7 +532,7 @@ This workflow is built from multiple composite actions listed below: | ref | ❌ | The default branch of your repository | string | ref name to checkout the repository | | python-version | ❌ | "3.10" | string | Python version for setting up Poetry | | poetry-version | ❌ | "1.5.1" | string | Poetry version to be installed | -| changelog | ❌ | false | boolean | If set to true, a CHANGELOG.md will be created when a release is done | +| changelog | ❌ | true | boolean | If set to true, a CHANGELOG.md will be created when a release is done | | changelog-config | ❌ | - | string | Path to the changelog config file. Only needed if changelog is set to true | | working-directory | ❌ | "./" | string | Working directory of your Python package | @@ -577,7 +577,7 @@ jobs: python-version: 3.8 # (Optional) Default value is 3.10. In this case Poetry is installed with Python 3.8 poetry-version: "1.1.11" # (Optional) Default value is 1.5.1. In this case Poetry version 1.1.11 is installed working-directory: "./my-awesome-python-project" # (Optional) Default value is the root directory of your repository. In this case all the files to the given path are published - changelog: true # (Optional) Default to false. Set only if you want to mantain a CHANGELOG.md + changelog: false # (Optional) Default to true. changelog-config: ./my-changelog-config.json # (Optional) Set only if changelog is set to true. More information about it here https://github.com/bakdata/ci-templates/tree/main/actions/changelog-generate secrets: github-email: ${{ secrets.GH_EMAIL }} @@ -1058,12 +1058,12 @@ This workflow is built from other composite actions listed below: ### Input Parameters -| Name | Required | Default Value | Type | Description | -| ----------------- | :------: | :-----------: | :-----: | ---------------------------------------------------------- | -| release-type | ✅ | - | string | Scope of the release (major, minor or patch) | -| changelog | ❌ | false | boolean | Create changelog for release | -| changelog-config | ❌ | - | string | Changelog config path | -| working-directory | ❌ | . | string | Working directory of project containing `.bumpversion.cfg` | +| Name | Required | Default Value | Type | Description | +| ----------------- | :------: | :-----------: | :-----: | -------------------------------------------------------------------------- | +| release-type | ✅ | - | string | Scope of the release (major, minor or patch) | +| changelog | ❌ | true | boolean | Create changelog for release | +| changelog-config | ❌ | - | string | Path to the changelog config file. Only needed if changelog is set to true | +| working-directory | ❌ | . | string | Working directory of project containing `.bumpversion.cfg` | ### Secret Parameters @@ -1109,7 +1109,7 @@ jobs: uses: bakdata/ci-templates/.github/workflows/bump-version-release.yaml@main with: release-type: "${{ github.event.inputs.release-type }}" - changelog: true # (Optional) Default is false + changelog: false # (Optional) Default is true changelog-config: "./.github/changelog-config.json" # (Optional) working-directory: "." # (Optional) Default is . secrets: diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 89f78f05c..24250334f 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -11,11 +11,12 @@ on: changelog: description: "Create changelog for release." required: false - default: false + default: true type: boolean changelog-config: description: "Changelog config path." required: false + default: "" type: string working-directory: description: "Working directory containing `.bumpversion.cfg`. (Default is .)" @@ -68,7 +69,7 @@ jobs: - name: Create changelog id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.25.4 + uses: bakdata/ci-templates/actions/changelog-generate@1.35.0 if: ${{ inputs.changelog == 'true' }} with: github-token: ${{ secrets.github-token }} diff --git a/.github/workflows/python-poetry-release.yaml b/.github/workflows/python-poetry-release.yaml index 835876c0a..08934cbc5 100644 --- a/.github/workflows/python-poetry-release.yaml +++ b/.github/workflows/python-poetry-release.yaml @@ -25,11 +25,12 @@ on: changelog: description: "Create changelog for release." required: false - default: false + default: true type: boolean changelog-config: description: "Changelog config path." required: false + default: "" type: string working-directory: description: "The working directory of your Python package. (Default is root directory)" @@ -84,7 +85,7 @@ jobs: - name: Create changelog id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.25.4 + uses: bakdata/ci-templates/actions/changelog-generate@1.35.0 if: ${{ inputs.changelog == true}} with: github-token: ${{ secrets.github-token }} diff --git a/actions/changelog-generate/README.md b/actions/changelog-generate/README.md index f4b0c57e3..6f4cbf967 100644 --- a/actions/changelog-generate/README.md +++ b/actions/changelog-generate/README.md @@ -53,16 +53,16 @@ Additional configuration options can be explored ## Input Parameters -| Name | Required | Default Value | Description | -| ------------------------- | :------: | :-----------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| github-token | ✅ | - | The GitHub token for committing the changes | -| new-tag | ✅ | - | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) | -| changelog-file | ❌ | "CHANGELOG.md" | Path to the Changelog.md file | -| commit-mode | ❌ | "false" | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. | -| config | ❌ | "$GITHUB_ACTION_PATH/changelog-config.json" | Path to the changelog config JSON file | -| fetch-release-information | ❌ | "false" | Will enable fetching additional release information from tags. | -| fetch-reviewers | ❌ | "false" | Will enable fetching the users/reviewers who approved the PR. | -| old-tag | ❌ | "" | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) | +| Name | Required | Default Value | Description | +| ------------------------- | :------: | :------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| github-token | ✅ | - | The GitHub token for committing the changes | +| new-tag | ✅ | - | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) | +| changelog-file | ❌ | "CHANGELOG.md" | Path to the Changelog.md file | +| commit-mode | ❌ | "false" | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. | +| config | ❌ | "" | Path to the changelog config JSON file | +| fetch-release-information | ❌ | "false" | Will enable fetching additional release information from tags. | +| fetch-reviewers | ❌ | "false" | Will enable fetching the users/reviewers who approved the PR. | +| old-tag | ❌ | "" | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) | ## Outputs diff --git a/actions/changelog-generate/action.yaml b/actions/changelog-generate/action.yaml index 4309ab9d5..54fcfa27e 100644 --- a/actions/changelog-generate/action.yaml +++ b/actions/changelog-generate/action.yaml @@ -21,7 +21,7 @@ inputs: config: description: Path to the changelog config JSON file required: false - default: "$GITHUB_ACTION_PATH/changelog-config.json" + default: "" fetch-release-information: description: "Will enable fetching additional release information from tags." required: false @@ -54,7 +54,7 @@ runs: if [[ "$tag_list" == *"${{ inputs.new-tag }}"* ]]; then echo "totag=${{ inputs.new-tag }}">> $GITHUB_OUTPUT else - echo "totag=$(git rev-parse HEAD)">> $GITHUB_OUTPUT + echo "totag=$(git rev-parse HEAD)">> $GITHUB_OUTPUT fi #from-tag @@ -64,8 +64,8 @@ runs: # tag provided & provided tag exists setfrom=${{ inputs.old-tag }} else - # no tag provided or a non-existing tag was provided - if [ -n "$tag_list" ]; then + # no tag provided or a non-existing tag was provided + if [ -n "$tag_list" ]; then # if any tag exists then set from-tag to the latest tag setfrom=$(git describe --tags `git rev-list --tags --max-count=1`) else @@ -73,9 +73,13 @@ runs: setfrom=$(git rev-list --max-parents=0 HEAD) fi fi - echo "fromtag=$setfrom">> $GITHUB_OUTPUT - # when using inputs.config directly it does not work and remapping it makes it work - echo "path=${{ inputs.config }}" >> "$GITHUB_OUTPUT" + echo "fromtag=$setfrom">> $GITHUB_OUTPUT + if [ -n "${{ inputs.config }}" ]; then + path="$GITHUB_ACTION_PATH/changelog-config.json)" + else + path=${{ inputs.config }} + fi + echo "path=$path" >> "$GITHUB_OUTPUT" shell: bash - name: "Create changelog"