-
Notifications
You must be signed in to change notification settings - Fork 1
Add support to create pre-releases with a generated changelog #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NotTheEvilOne
wants to merge
1
commit into
main
Choose a base branch
from
feature/support-pre-release-changelog
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| name: pre-release | ||
|
|
||
| on: | ||
| push: | ||
| tags: [ "[0-9]+.[0-9]+.[0-9]+*" ] | ||
|
|
||
| jobs: | ||
| create-pre-release: | ||
NotTheEvilOne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout commit | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| sparse-checkout: | | ||
| cliff.toml | ||
| sparse-checkout-cone-mode: false | ||
| - uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main | ||
| - name: Use cargo cache | ||
| id: cache-cargo | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo | ||
| key: gh-release-${{ runner.os }}-cargo-${{ hashFiles('~/.cargo/.crates.toml') }} | ||
| restore-keys: gh-release-${{ runner.os }}-cargo- | ||
| - name: Install git-cliff | ||
| if: steps.cache-cargo.outputs.cache-hit != 'true' | ||
| run: | | ||
| cargo install git-cliff | ||
| - name: Get the Git tag name | ||
| id: get-tag-name | ||
| run: echo "tag-name=${GITHUB_REF/refs\/tags\//}" | tee -a "$GITHUB_OUTPUT" | ||
| - id: release | ||
| name: Create changelog and release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gl-gh-release create \ | ||
| --repo "python-gardenlinux-lib" \ | ||
| --tag "${{ steps.get-tag-name.outputs.tag-name }}" \ | ||
| --commit "${{ github.sha }}" \ | ||
| --name 'python-gardenlinux-lib v${{ steps.get-tag-name.outputs.tag-name }}' \ | ||
| --latest \ | ||
| --body " | ||
| $(git-cliff -o - --current) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These look really nice! |
||
| " | ||
This file contains hidden or 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,84 @@ | ||
| # git-cliff ~ configuration file | ||
| # https://git-cliff.org/docs/configuration | ||
|
|
||
| [changelog] | ||
| # A Tera template to be rendered as the changelog's header. | ||
| # See https://keats.github.io/tera/docs/#introduction | ||
| header = """ | ||
| {% if version -%} | ||
| # Changelog for {{ version }} }} | ||
| {% else -%} | ||
| # Changelog | ||
| {% endif -%} | ||
|
|
||
| All notable changes since last release will be documented below. | ||
| """ | ||
| # A Tera template to be rendered for each release in the changelog. | ||
| # See https://keats.github.io/tera/docs/#introduction | ||
| body = """ | ||
| {%- macro remote_url() -%} | ||
| https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} | ||
| {%- endmacro -%} | ||
|
|
||
| {% for group, commits in commits | group_by(attribute="group") %} | ||
| ### {{ group | upper_first }} | ||
| {%- for commit in commits %} | ||
| - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\ | ||
| {% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%} | ||
| {% if commit.remote.pr_number %} in \ | ||
| [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \ | ||
| {%- endif -%} | ||
| {% endfor %} | ||
| {% endfor %} | ||
| """ | ||
| # A Tera template to be rendered as the changelog's footer. | ||
| # See https://keats.github.io/tera/docs/#introduction | ||
| footer = """ | ||
| {%- macro remote_url() -%} | ||
| https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} | ||
| {%- endmacro -%} | ||
|
|
||
| {% for release in releases -%} | ||
| {% if release.version -%} | ||
| {% if release.previous.version -%} | ||
| [{{ release.version | trim_start_matches(pat="v") }}]: \ | ||
| {{ self::remote_url() }}/compare/{{ release.previous.version }}...{{ release.version }} | ||
| {% endif -%} | ||
| {% else -%} | ||
| [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}...HEAD | ||
| {% endif -%} | ||
| {% endfor %} | ||
| <!-- generated by git-cliff --> | ||
| """ | ||
| # Remove leading and trailing whitespaces from the changelog's body. | ||
| trim = true | ||
|
|
||
| [git] | ||
| # Parse commits according to the conventional commits specification. | ||
| # See https://www.conventionalcommits.org | ||
| conventional_commits = true | ||
| # Exclude commits that do not match the conventional commits specification. | ||
| filter_unconventional = false | ||
| # An array of regex based parsers for extracting data from the commit message. | ||
| # Assigns commits to groups. | ||
| # Optionally sets the commit's scope and can decide to exclude commits from further processing. | ||
| commit_parsers = [ | ||
| { message = "^[a|A]dd", group = "Added" }, | ||
| { message = "^[s|S]upport", group = "Added" }, | ||
| { message = "^[r|R]emove", group = "Removed" }, | ||
| { message = "^.*: add", group = "Added" }, | ||
| { message = "^.*: support", group = "Added" }, | ||
| { message = "^.*: remove", group = "Removed" }, | ||
| { message = "^.*: delete", group = "Removed" }, | ||
| { message = "^test", group = "Fixed" }, | ||
| { message = "^fix", group = "Fixed" }, | ||
| { message = "^.*: fix", group = "Fixed" }, | ||
| { message = "^.*", group = "Changed" }, | ||
| ] | ||
| # Prevent commits that are breaking from being excluded by commit parsers. | ||
| filter_commits = false | ||
| # Order releases topologically instead of chronologically. | ||
| topo_order = true | ||
| # Order of commits in each group/release within the changelog. | ||
| # Allowed values: newest, oldest | ||
| sort_commits = "oldest" |
This file contains hidden or 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,6 @@ | ||
| python-gardenlinux-lib release documentation | ||
| ============================================ | ||
|
|
||
| *python-gardenlinux-lib* strictly follow syntax and intention of `Semantic Versioning <https://www.semver.org>`. Each release reflects the intention and expected impact therefore. | ||
|
|
||
| A new release is done by tagging a commit with a valid version. This will create a GitHub pre-release for proof-reading. Once done a new release can be published using GitHub CLI or UI. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.