Skip to content

Commit

Permalink
Promote to release (#21)
Browse files Browse the repository at this point in the history
* feat: add github workflow

* feat: add dependency

* feat: activate poetry environment

* feat: remove shell activation

* feat: save new tag version on remote

* feat: add workflow for prereleases

* feat: add workflow for prereleases

* feat: catch latest tag

* feat: catch latest tag

* feat: generate release

* feat: generate release

* Promote CI to Alpha (#16)

* feat: testing changelog

* feat: testing changelog (#1)

* feat: testing changelog

* feat: prerelease workflow configuration (#2)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add categorized commits (#3)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* fix: add configuration path to ci (#4)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* fix: remove branch filter (#5)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* fix: remove labels  (#6)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* fix: ci/prerelease workflow (#7)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* fix: remove extra config (#8)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#9)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#10)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#11)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: ci/prerelease workflow (#12)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow remove tag config (#13)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: ci/prerelease workflow (#14)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: update changelog config

* feat: update changelog config

---------

Co-authored-by: Christopher A. Flores <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Promote CI to Alpha (#17)

* feat: testing changelog

* feat: testing changelog (#1)

* feat: testing changelog

* feat: prerelease workflow configuration (#2)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add categorized commits (#3)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* fix: add configuration path to ci (#4)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* fix: remove branch filter (#5)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* fix: remove labels  (#6)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* fix: ci/prerelease workflow (#7)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* fix: remove extra config (#8)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#9)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#10)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#11)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: ci/prerelease workflow (#12)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow remove tag config (#13)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: ci/prerelease workflow (#14)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: update changelog config

* feat: update changelog config

* feat: add release workflow

---------

Co-authored-by: Christopher A. Flores <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Promote CI to Alpha (#19)

* feat: testing changelog

* feat: testing changelog (#1)

* feat: testing changelog

* feat: prerelease workflow configuration (#2)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add categorized commits (#3)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* fix: add configuration path to ci (#4)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* fix: remove branch filter (#5)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* fix: remove labels  (#6)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* fix: ci/prerelease workflow (#7)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* fix: remove extra config (#8)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#9)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#10)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow (#11)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: ci/prerelease workflow (#12)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* fix: ci/prerelease workflow remove tag config (#13)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: ci/prerelease workflow (#14)

* feat: testing changelog

* feat: testing changelog

* feat: add categorized commits

* feat: add configuration path

* feat: remove base branch filter

* feat: remove label filters

* feat: omit from and to

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: remove extra config

* feat: testing new changelog action

* fix: remove action trigger

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.20

* fix: add github token

* fix: add github token

* fix: add github token

* fix: add github token

* [Changelog CI] Add Changelog for Version v1.0.0-alpha.21

* fix: add changelog config

* fix: add changelog config

* fix: add changelog config

* fix: remove changelog prefix

* fix: update changelog_type

* fix: update changelog_type

* fix: update changelog_type

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: replace changelog action

* fix: replace changelog action

* fix: replace changelog action

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: testing auto pr

* feat: update changelog config

* feat: update changelog config

* feat: add release workflow

* feat: add release workflow

* feat: add release workflow

---------

Co-authored-by: Christopher A. Flores <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: remove unnecesary steps

* fix: remove dagger from ci process

* fix: update versioning for breaking changes

* fix: add full history on workflow

* feat: add cliff to produce changelog

* feat: add cliff setup

* feat: echo content

* feat: echo content

* feat: echo content

* feat: echo content

* feat: echo content

* fix: add changelog for latest tag

* fix: remove changelog files

* feat: customize changelog template

* chore: add commit id into changelog

* fix: prevent duplicate tags

* chore: add EOF for testing

* ci: prevent new tags

* fix: remove unused dependencies

* fix: add missing workflow step

* fix: update dependencies groups

* feat: add release workflow

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 4, 2023
1 parent 9d41867 commit 4cbfb08
Show file tree
Hide file tree
Showing 37 changed files with 177 additions and 464 deletions.
69 changes: 27 additions & 42 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ name: Pre-release version

on:
push:
branches: [ci/prerelease-workflow]
branches: [alpha, beta, rc]

jobs:
publish:
compute-new-tag-version:
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
fromTag: ${{ steps.fromTag.outputs.tag }}
toTag: ${{ steps.toTag.outputs.tag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
Expand All @@ -31,58 +34,40 @@ jobs:
- name: Install deps
run: poetry install

- name: Run Dagger pipeline
run: poetry run python ci.py
- name: Run matic-release
run: poetry run python main.py

- name: Publish tag
run: git push --tags

- name: 'Get lastest tag'
id: toTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- uses: actions/checkout@v3
with:
ref: alpha

- name: Reset promotion branch
run: |
git fetch origin ${{ github.ref_name }}:${{ github.ref_name }}
git reset --hard ${{ github.ref_name }}
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3

generate-release:
runs-on: ubuntu-latest
needs: compute-new-tag-version
if: ${{ needs.compute-new-tag-version.outputs.fromTag != needs.compute-new-tag-version.outputs.toTag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
toTag: ${{ steps.toTag.outputs.tag }}
configuration: "changelog-config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Echo Changelog
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: echo "$CHANGELOG"
- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v1

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Promote CI to Alpha
body: ${{ steps.github_release.outputs.changelog }}
branch: ${{ github.ref_name }}
reviewers: cafadev
assignees: cafadev
delete-branch: true
draft: true
labels: |
release
automated
- name: Run git-cliff
run: |
{
echo 'CHANGELOG<<EOF'
git cliff --latest
echo EOF
} >> "$GITHUB_ENV"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.github_release.outputs.changelog }}
body: ${{ env.CHANGELOG }}
prerelease: true
tag_name: ${{ steps.toTag.outputs.tag }}
tag_name: ${{ needs.compute-new-tag-version.outputs.toTag }}
47 changes: 29 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Pre-release version
name: Release version

on:
push:
branches: [main]

jobs:
publish:
compute-new-tag-version:
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
fromTag: ${{ steps.fromTag.outputs.tag }}
toTag: ${{ steps.toTag.outputs.tag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
Expand All @@ -31,32 +34,40 @@ jobs:
- name: Install deps
run: poetry install

- name: Run Dagger pipeline
run: poetry run python ci.py
- name: Run matic-release
run: poetry run python main.py

- name: Publish tag
run: git push --tags

- name: 'Get lastest tag'
id: toTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3

generate-release:
runs-on: ubuntu-latest
needs: compute-new-tag-version
if: ${{ needs.compute-new-tag-version.outputs.fromTag != needs.compute-new-tag-version.outputs.toTag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
toTag: ${{ steps.toTag.outputs.tag }}
configuration: "changelog-config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v1

- name: Echo Changelog
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: echo "$CHANGELOG"
- name: Run git-cliff
run: |
{
echo 'CHANGELOG<<EOF'
git cliff --latest
echo EOF
} >> "$GITHUB_ENV"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.github_release.outputs.changelog }}
tag_name: ${{ steps.toTag.outputs.tag }}
body: ${{ env.CHANGELOG }}
prerelease: false
tag_name: ${{ needs.compute-new-tag-version.outputs.toTag }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/__pycache__
.pytest_*
75 changes: 75 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://tera.netlify.app/docs
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "✨ Features" },
{ message = "^fix", group = "🐛 Bug Fixes" },
{ message = "^doc", group = "📝 Documentation" },
{ message = "^perf", group = "⚡️ Performance" },
{ message = "^refactor", group = "♻️ Refactor" },
{ message = "^style", group = "💄 Styling" },
{ message = "^test", group = "✅ Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "🔨 Miscellaneous Tasks" },
{ body = ".*security", group = "🔐 Security" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

compute_tag.execute(version)

# publish = PublishTag(git)
publish = PublishTag(git)

# publish.execute(version)
publish.execute(version)

print(version.future_tag.value)

Binary file removed matic_release/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed matic_release/__pycache__/__main__.cpython-311.pyc
Binary file not shown.
Binary file removed matic_release/__pycache__/config.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed matic_release/axioma/__pycache__/git.cpython-311.pyc
Binary file not shown.
Binary file removed matic_release/axioma/__pycache__/tag.cpython-311.pyc
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions matic_release/axioma/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def set_stage(self, stage: TagStage) -> None:
def reset_minor(self) -> None:
self.minor = 0
self.patch = 0
self.revision = 0
self.revision = 1

def reset_patch(self) -> None:
self.patch = 0
self.revision = 0
self.revision = 1

def reset_revision(self) -> None:
self.revision = 0
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 6 additions & 2 deletions matic_release/capabilities/commit_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import StrEnum
from matic_release.axioma.tag import TagStage
from matic_release.axioma.version import Version


Expand All @@ -18,10 +19,13 @@ class CommitAnalyzerAction(StrEnum):
class CommitAnalyzer:

def execute(self, version: Version, commit_message: str) -> CommitAnalyzerAction | None:
is_breaking_change = 'BREAKING-CHANGE' in commit_message
is_prerelease = version.current_tag.is_prerelease
is_breaking_change = next((
bool(breaking) for breaking in ['BREAKING-CHANGE', 'BREAKING CHANGE'] if breaking in commit_message
), False)

if is_breaking_change:
return CommitAnalyzerAction.major
return CommitAnalyzerAction.revision if is_prerelease else CommitAnalyzerAction.major

rules_keys = list(rules)

Expand Down
12 changes: 10 additions & 2 deletions matic_release/capabilities/compute_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def __init__(self, git: Git, commit_analyzer: CommitAnalyzer) -> None:
self.commit_analyzer = commit_analyzer

def execute(self, version: Version) -> None:
current_branch = self.git.get_current_branch()
stage: TagStage = branches.get(current_branch, TagStage.alpha)

commit_message = self.git.get_latest_commit_message()
action = self.commit_analyzer.execute(version, commit_message)
current_branch = self.git.get_current_branch()

actions = {
CommitAnalyzerAction.major: version.future_tag.increment_major,
Expand All @@ -24,9 +26,13 @@ def execute(self, version: Version) -> None:
CommitAnalyzerAction.revision: version.future_tag.increment_revision
}

stage: TagStage = branches.get(current_branch, TagStage.alpha)
action_trigger: Callable[[], None] | None = None

if version.current_tag.is_prerelease and stage is TagStage.release:
version.future_tag.set_stage(stage)
version.future_tag.reset_revision()
return

if action:
action_trigger = actions.get(action, None)

Expand All @@ -36,9 +42,11 @@ def execute(self, version: Version) -> None:
if not version.current_tag.is_prerelease:
version.future_tag.set_stage(stage)
version.future_tag.reset_revision()
version.future_tag.increment_revision()
return

if stage is not version.current_tag.stage:
version.future_tag.set_stage(stage)
version.future_tag.reset_revision()
version.future_tag.increment_revision()
return
6 changes: 3 additions & 3 deletions matic_release/capabilities/publish_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def execute(self, version: Version) -> None:
has_hash = self.git.get_tag_hash(version.future_tag.value)

if has_hash is not None:
print(f"Unable to set tag {version.future_tag.value}.")
raise UnprocessableExistingTag()
print(f"Unable to set new tag{version.future_tag.value}.")
return

self.git.push_tag(version.future_tag.value)
self.git.push_tag(version.future_tag.value)
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 4cbfb08

Please sign in to comment.