The next version of the release. Defaults to “\({{ steps.release.outputs.NEXT_VERSION }}". | `'\){{ steps.release.outputs.NEXT_VERSION }}‘| | release_notes_filepath | [str](str) | The file path to the release notes. Defaults to ".github/latest-release.md". |’.github/latest-release.md’| | release_target | [str](str) | The target commit hash for the release. Defaults to the current commit hash. |get_current_hash()| | repo | [str](str) | The GitHub repository in the format "owner/repo". Defaults to "${{ github.repository }}". |‘${{ github.repository }}’| | debug | [bool](bool) | If True, print the command instead of executing it. Defaults to False. |False`
Returns
Name
Type
Description
str
The URL of the created release draft, or an empty string if in debug mode.
This function reads the changelog file and prepares it for the next release by replacing the development version header with the next version string and collecting lines for the next release.
The header used for the development version in the changelog. Defaults to “development version”.
'development version'
Returns
Name
Type
Description
tuple
A tuple containing two lists: - changelog_lines (list): The complete list of lines from the changelog file with the development version header replaced. - next_release_lines (list): The list of lines that pertain to the next release.
This function performs cleanup tasks after a release has been created. It updates the changelog, resets the version file, and creates a pull request to merge the changes back into the main branch.
The GitHub repository (default is “\({{ github.repository }}"). | `'\){{ github.repository }}‘| | release_tag | [str](str) | The tag of the release (default is "${{ github.ref_name }}"). |’\({{ github.ref_name }}'` |
| pr_branch | [str](`str`) | The branch for the pull request (default is "\){{ inputs.branch }}”).
The reviewer for the pull request (default is “\({{ github.triggering_actor }}"). | `'\){{ github.triggering_actor }}‘| | draft_branch | [str](str) | The name of the draft branch (default is "release-draft"). |’release-draft’| | dev_header | [str](str) | The header for the development version section in the changelog (default is "development version"). |‘development version’| | version_filepath | [str](str) | The path to the version file (default is "VERSION"). |‘VERSION’| | citation_filepath | [str](str) | The path to the citation file (default is "CITATION.cff"). |‘CITATION.cff’| | description_filepath | [str](str) | Path to the R DESCRIPTION file for R packages (default is "DESCRIPTION"). |‘DESCRIPTION’| | debug | [bool](bool) | If True, print debug information instead of executing commands (default is False). |False`
Prepare the release by updating version, changelog, and release notes.
This function prepares the release by resolving file paths, determining the next version, updating the changelog and release notes, and setting the next version as an output.
The manually specified next version (default is “\({{ github.event.inputs.version_tag }}"). | `'\){{ github.event.inputs.version_tag }}‘| | next_version_convco | [str](str) | The next version determined by conventional commit history (default is "${{ steps.semver.outputs.next }}"). |’\({{ steps.semver.outputs.next }}'` |
| current_version | [str](`str`) | The current version of the project (default is "\){{ steps.semver.outputs.current }}”).
The name of the GitHub event triggering the release (default is “\({{ github.event_name }}"). | `'\){{ github.event_name }}‘| | changelog_filepath | [str](str) | The path to the changelog file (default is "CHANGELOG.md"). |’CHANGELOG.md’| | dev_header | [str](str) | The header for the development version section in the changelog (default is "development version"). |‘development version’| | release_notes_filepath | [str](str) | The path to the release notes file (default is ".github/latest-release.md"). |‘.github/latest-release.md’| | version_filepath | [str](str) | The path to the version file (default is "VERSION"). |‘VERSION’| | citation_filepath | [str](str) | The path to the citation file (default is "CITATION.cff"). |‘CITATION.cff’| | release_branch | [str](str) | The name of the release branch (default is "release-draft"). |‘release-draft’| | pr_ref_name | [str](str) | The reference name of the pull request (default is "${{ github.ref_name }}"). |’\({{ github.ref_name }}'` |
| repo | [str](`str`) | The GitHub repository (default is "\){{ github.repository }}”).
Pushes a release draft branch to the remote repository.
This function creates or switches to a specified release branch, merges changes from a pull request reference, stages specified files, commits the changes with a message indicating the next version, and pushes the branch to the remote repository. If the branch already exists, it will be deleted before creating a new one.
The reference name of the pull request to merge. Defaults to “\({{ github.ref_name }}". | `'\){{ github.ref_name }}’| | next_version | [str](str) | The next version number to include in the commit message. Defaults to None. |None| | files | [list](list) | A list of files to stage and commit. Defaults to ["CHANGELOG.md", "VERSION", "CITATION.cff"]. |[‘CHANGELOG.md’, ‘VERSION’, ‘CITATION.cff’]| | debug | [bool](bool) | If True, prints the generated git commands instead of executing them. Defaults to False. |False`
Set the next release version for GitHub Actions based on manual input or conventional commit history.
This function determines and sets the next release version for GitHub Actions. It uses either a manually specified version or a version determined by conventional commit history. The determined version is then set as an output for use in subsequent GitHub Actions steps.
The manually specified next version (default is “\({{ github.event.inputs.version_tag }}"). | `'\){{ github.event.inputs.version_tag }}‘| | next_version_convco | [str](str) | The next version determined by conventional commit history (default is "${{ steps.semver.outputs.next }}"). |’\({{ steps.semver.outputs.next }}'` |
| current_version | [str](`str`) | The current version of the project (default is "\){{ steps.semver.outputs.current }}”).
If True, print updates instead of writing to file.
False
write_lines
release.write_lines(filepath, lines, debug=False)
Write lines to a file or return them as a string for debugging.
This function writes the provided lines to a specified file. If debugging is enabled,
it returns the lines as a single string instead of writing to the file.
Args:
filepath (str): The path to the file where the lines should be written.
lines (list of str): The lines to write to the file.
debug (bool): If True, return the lines as a single string instead of writing to the file (default is False).
Returns:
str: The lines as a single string if debugging is enabled, otherwise None.
Examples:
>>> write_lines("output.txt", ["line 1