Skip to content

feat: ✨ add Commitizen version bump with GitHub workflow #71

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

Merged
merged 13 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
with:
enable-cache: true

- name: Install justfile
run: sudo apt-get install -y just
- name: Install justfile and zsh
run: sudo apt install -y just zsh

- name: Test and check template creation
run: just test
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ spaid_gh_set_repo_settings -h
spaid_gh_ruleset_basic_protect_main -h
```

Some configuration is needed after copying this template to a new
repository, including configuration external to the repository.

- The template file `.github/workflows/release-package.yml` requires
installing the
[auto-release-token](https://github.com/apps/auto-release-token)
GitHub App to be installed, as well as a GitHub secret called
`UPDATE_VERSION_TOKEN` and a variable called `UPDATE_VERSION_APP_ID`
to be set up in the repository (or organization) settings. See this
[guide](https://guidebook.seedcase-project.org/operations/security#using-github-apps-to-generate-tokens)
for more details on how to set this up.

## Features

- Use [uv](https://docs.astral.sh/uv/) to manage the Data Package.
Expand Down
1 change: 0 additions & 1 deletion copier.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
_subdirectory: template

# Questions:

package_github_repo:
type: str
default: "NA"
Expand Down
15 changes: 7 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ check-spelling:

test:
#!/bin/zsh
temp_dir="_temp/test-data-package"
rm -rf $temp_dir
mkdir -p $temp_dir
test_dir="$(pwd)/_temp"
test_name="test-data-package"
rm -rf $test_dir
# vcs-ref means the current commit/head, not a tag.
# `.` means the current directory contains the template.
uvx copier copy --vcs-ref=HEAD . $temp_dir \
uvx copier copy --vcs-ref=HEAD . $test_dir/$test_name \
--defaults \
--data package_abbrev= "test-data-package" \
--data package_github="first-last/test-data-package" \
--data package_abbrev=$test_name \
--data package_github_repo="first-last/${test_name}" \
--data author_given_name="First" \
--data author_family_name="Last" \
--data author_email="first.last@example.com"
# TODO: Other checks/tests?

cleanup:
#!/bin/zsh
temp_dir=$("_temp/test-data-package"))
rm -rf $temp_dir
rm -rf _temp
10 changes: 10 additions & 0 deletions template/.cz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tool.commitizen]
bump_message = "build(version): :bookmark: update version from $current_version to $new_version [skip ci]"
update_changelog_on_bump = true
version_provider = "uv"
version_files = [
"pyproject.toml:version",
"scripts/properties.py:version"
]
# Don't regenerate the changelog on every update
changelog_incremental = true
6 changes: 3 additions & 3 deletions template/.github/workflows/add-to-project.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: seedcase-project/.github/.github/workflows/reusable-add-to-project.yml@main
with:
board-number: 18
app-id: ${{ vars.ADD_TO_BOARD_APP_ID }}
app-id: {{ '${{ vars.ADD_TO_BOARD_APP_ID }}' }}
secrets:
add-to-board-token: ${{ secrets.ADD_TO_BOARD }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
add-to-board-token: {{ '${{ secrets.ADD_TO_BOARD }}' }}
gh-token: {{ '${{ secrets.GITHUB_TOKEN }}' }}
21 changes: 21 additions & 0 deletions template/.github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release package

on:
push:
branches:
- main

# Limit token permissions for security
permissions: read-all

jobs:
release:
# This job outputs env variables `previous_version` and `current_version`.
# Only give permissions for this job.
permissions:
contents: write
uses: seedcase-project/.github/.github/workflows/reusable-release-project.yml@main
with:
app-id: ${{ vars.UPDATE_VERSION_APP_ID }}
secrets:
update-version-gh-token: ${{ secrets.UPDATE_VERSION_TOKEN }}
13 changes: 13 additions & 0 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@

## Post-setup steps

- Run `just list-todos` to get a list of TODO items you need to fill out.

## Versioning and changelog

This project uses
[Commitizen](https://commitizen-tools.github.io/commitizen/) to update
versions and generate changelogs. Based on the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) message, it
will automatically update the version in both `pyproject.toml` and
`datapackage.json`. The [Data Package](https://datapackage.org/)
standard suggests using their version of [Semantic
Versioning](https://datapackage.org/recipes/data-package-version/). So
follow these conventions when making commits to this repository.
4 changes: 2 additions & 2 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ dependencies = [
"seedcase-sprout>=0.46.3",
]

{{ if package_github != "NA" }}
{% if package_github_repo != "NA" %}
[project.urls]
issues = "https://github.com/{{ package_github_repo }}/issues"
repository = "https://github.com/{{ package_github_repo }}"
{{ endif }}
{% endif %}

[dependency-groups]
dev = [
Expand Down
Loading