Skip to content

Commit

Permalink
Test Versioning
Browse files Browse the repository at this point in the history
Signed-off-by: dornech <[email protected]>
  • Loading branch information
dornech committed Dec 11, 2024
1 parent 0981a1c commit 6926f91
Show file tree
Hide file tree
Showing 9 changed files with 372 additions and 20 deletions.
123 changes: 123 additions & 0 deletions .changelog-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# For more configuration information, please see https://callowayproject.github.io/generate-changelog/

# User variables for reference in other parts of the configuration.
variables:
changelog_filename: CHANGELOG.md

# Pipeline to find the most recent tag for incremental changelog generation.
# Leave empty to always start at first commit.
starting_tag_pipeline:
- action: ReadFile
kwargs:
filename: '{{ changelog_filename }}'
- action: FirstRegExMatch
kwargs:
pattern: (?im)^## (?P<rev>\d+\.\d+(?:\.\d+)?)\s+\(\d+-\d{2}-\d{2}\)$
named_subgroup: rev

# Used as the version title of the changes since the last valid tag.
unreleased_label: Unreleased

# Process the commit's first line for use in the changelog.
summary_pipeline:
- action: strip_spaces
- action: Strip
comment: Get rid of any periods so we don't get double periods
kwargs:
chars: .
- action: SetDefault
args:
- no commit message
- action: capitalize
- action: append_dot

# Process the commit's body for use in the changelog.
body_pipeline:
- action: ParseTrailers
comment: Parse the trailers into metadata.
kwargs:
commit_metadata: save_commit_metadata

# Process and store the full or partial changelog.
output_pipeline:
- action: IncrementalFileInsert
kwargs:
filename: '{{ changelog_filename }}'
last_heading_pattern: (?im)^## \d+\.\d+(?:\.\d+)?\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)$

# Full or relative paths to look for output generation templates.
template_dirs:
- .github/changelog_templates/

# Group the commits within a version by these commit attributes.
group_by:
- metadata.category

# Only tags matching this regular expression are used for the changelog.
# tag_pattern: ^[0-9]+\.[0-9]+(?:\.[0-9]+)?$
# tag_pattern: ^v[0-9]+\.[0-9]+(?:\.[0-9]+)?$
# Version tags RegEx from https://regex101.com/r/vkijKf/1/ preceeded by v
tag_pattern: ^(v0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

# Tells ``git-log`` whether to include merge commits in the log.
include_merges: true

# Ignore commits whose summary line matches any of these regular expression patterns.
ignore_patterns:
- '[@!]minor'
- '[@!]cosmetic'
- '[@!]refactor'
- '[@!]wip'
- ^$
- ^Merge branch
- ^Merge pull

# Set the commit's category metadata to the first classifier that returns ``True``.
commit_classifiers:
- action: SummaryRegexMatch
category: New
kwargs:
pattern: (?i)^(?:new|add)[^\n]*$
- action: SummaryRegexMatch
category: Updates
kwargs:
pattern: (?i)^(?:update|change|rename|remove|delete|improve|refactor|chg|modif)[^\n]*$
- action: SummaryRegexMatch
category: Fixes
kwargs:
pattern: (?i)^(?:fix)[^\n]*$
- action:
category: Other

# Tokens in git commit trailers that indicate authorship.
valid_author_tokens:
- author
- based-on-a-patch-by
- based-on-patch-by
- co-authored-by
- co-committed-by
- contributions-by
- from
- helped-by
- improved-by
- original-patch-by

# Rules applied to commits to determine the type of release to suggest.
release_hint_rules:
- match_result: dev
branch: ^((?!master|main).)*$
- match_result: patch
grouping: Other
branch: master|main
- match_result: patch
grouping: Fixes
branch: master|main
- match_result: minor
grouping: Updates
branch: master|main
- match_result: minor
grouping: New
branch: master|main
- match_result: major
grouping: Breaking Changes
branch: master|main
52 changes: 42 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request ]

jobs:

dump-contexts:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump context "GitHub"
Expand All @@ -14,18 +14,14 @@ jobs:

build-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python_version: [ '3.x' ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
python-version: [ '3.x' ]
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -67,7 +63,7 @@ jobs:
name: python-package-distributions
path: dist/

build-publish-testpypi:
publish-testpypi:
runs-on: ubuntu-latest
needs: build-distribution
environment:
Expand All @@ -93,7 +89,7 @@ jobs:
# user: __token__
# password: ${{ secrets.TEST_PYPI_SECRECT }}

build-publish-pypi:
publish-pypi:
runs-on: ubuntu-latest
needs: [ build-distribution, build-publish-testpypi ]
environment:
Expand All @@ -110,11 +106,47 @@ jobs:
name: python-package-distributions
path: dist/
- name: Publish 📦 to PyPI
# if: startsWith(github.ref, 'refs/heads/main')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# url = "https://upload.pypi.org/legacy/"
# repository-url = "https://upload.pypi.org/legacy/"
verbose: true
# user: __token__
# password: ${{ secrets.PYPI_SECRECT }}

github-release:
runs-on: ubuntu-latest
needs: publish-pypi
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the Python 🐍 distribution 📦 with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defaults:

jobs:

dump-contexts:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump context "GitHub"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:

dump-contexts:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump context "GitHub"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- master

permissions:
actions: read
Expand All @@ -14,7 +13,7 @@ permissions:

jobs:

dump-contexts:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump context "GitHub"
Expand All @@ -31,3 +30,4 @@ jobs:
uses: crazy-max/[email protected]
with:
skip-delete: true
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defaults:

jobs:

dump-contexts:
dump-context:
runs-on: ubuntu-latest
steps:
- name: Dump context "GitHub"
Expand Down
Loading

0 comments on commit 6926f91

Please sign in to comment.