Skip to content

Commit c871328

Browse files
authored
chore: add release and CLA process from Tesseract Core (#41)
This pulls in recent changes from Tesseract Core.
1 parent 30c3a08 commit c871328

File tree

4 files changed

+255
-64
lines changed

4 files changed

+255
-64
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Please use a PR title that conforms to *conventional commits*: "<commit_type>: Describe your change"; for example: "fix: prevent race condition". Some other commit types are: fix, feat, ci, doc, refactor...
3-
For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0-beta.2/
3+
For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0/
44
-->
55

66
#### Relevant issue or PR
@@ -11,52 +11,3 @@ For a full list of commit types visit https://www.conventionalcommits.org/en/v1.
1111

1212
#### Testing done
1313
<!-- Describe how the changes were tested; e.g., "CI passes", "Tested manually in stagingrepo#123", screenshots of a terminal session that verify the changes, or any other evidence of testing the changes. -->
14-
15-
#### License
16-
17-
- [ ] By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license](https://pasteurlabs.github.io/tesseract-jax/LICENSE).
18-
- [ ] I sign the Developer Certificate of Origin below by adding my name and email address to the `Signed-off-by` line.
19-
20-
<details>
21-
<summary><b>Developer Certificate of Origin</b></summary>
22-
23-
```text
24-
Developer Certificate of Origin
25-
Version 1.1
26-
27-
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
28-
29-
Everyone is permitted to copy and distribute verbatim copies of this
30-
license document, but changing it is not allowed.
31-
32-
33-
Developer's Certificate of Origin 1.1
34-
35-
By making a contribution to this project, I certify that:
36-
37-
(a) The contribution was created in whole or in part by me and I
38-
have the right to submit it under the open source license
39-
indicated in the file; or
40-
41-
(b) The contribution is based upon previous work that, to the best
42-
of my knowledge, is covered under an appropriate open source
43-
license and I have the right under that license to submit that
44-
work with modifications, whether created in whole or in part
45-
by me, under the same open source license (unless I am
46-
permitted to submit under a different license), as indicated
47-
in the file; or
48-
49-
(c) The contribution was provided directly to me by some other
50-
person who certified (a), (b) or (c) and I have not modified
51-
it.
52-
53-
(d) I understand and agree that this project and the contribution
54-
are public and that a record of the contribution (including all
55-
personal information I submit with it, including my sign-off) is
56-
maintained indefinitely and may be redistributed consistent with
57-
this project or the open source license(s) involved.
58-
```
59-
60-
</details>
61-
62-
Signed-off-by: [YOUR NAME] <[YOUR EMAIL]>

.github/workflows/cla.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "CLA Assistant"
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_target:
7+
types: [opened,closed,synchronize]
8+
9+
jobs:
10+
cla-assistant:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "CLA Assistant"
14+
if: startsWith(github.event.comment.body, '@PasteurBot') || github.event.comment.body == 'recheck' || github.event_name == 'pull_request_target'
15+
uses: contributor-assistant/[email protected]
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
18+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
19+
with:
20+
allowlist: 'PasteurBot,dependabot[bot],github-actions[bot]'
21+
22+
remote-organization-name: 'pasteurlabs'
23+
remote-repository-name: 'pasteur-oss-cla-signatures'
24+
path-to-signatures: 'signatures/version1/cla.json'
25+
branch: 'main'
26+
27+
create-file-commit-message: 'Creating file for storing CLA Signatures'
28+
signed-commit-message: '$contributorName has signed the CLA in $owner/$repo'
29+
custom-notsigned-prcomment: >
30+
#### CLA signatures required
31+
32+
Thank you for your PR, we really appreciate it!
33+
Like many open-source projects, we ask that all contributors sign our
34+
[Contributor License Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md)
35+
before we can accept your contribution. This only needs to be done once per contributor.
36+
You can do so by commenting the following on this pull request:
37+
custom-allsigned-prcomment: >
38+
#### CLA signatures confirmed
39+
40+
All contributors have signed the [Contributor License Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md).
41+
custom-pr-sign-comment: |
42+
@PasteurBot I have read the CLA Document and I hereby sign the CLA

.github/workflows/release.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Handle release process
2+
3+
# This workflow automates the release process.
4+
# Only safe to use if the following conditions are met:
5+
# 1. `main` is protected and requires a PR to merge.
6+
# 2. Only squash-merging is allowed.
7+
# 3. PRs are required to be up-to-date with `main` before merging.
8+
# 4. Everyone is forbidden from creating releases manually.
9+
10+
on:
11+
# Case 1: manual trigger -> initiate release process
12+
workflow_dispatch:
13+
14+
# Case 2: release PR is being updated -> update changelog
15+
push:
16+
branches:
17+
- 'bot/release/*'
18+
19+
# Case 3: release PR is merged -> create a new release
20+
pull_request:
21+
types:
22+
- closed
23+
branches:
24+
- main
25+
26+
env:
27+
GH_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
28+
29+
jobs:
30+
trigger-pr:
31+
runs-on: ubuntu-latest
32+
if: github.event_name == 'workflow_dispatch'
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
with:
38+
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
39+
fetch-depth: 0
40+
fetch-tags: true
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version-file: "pyproject.toml"
46+
47+
- name: Install git-cliff
48+
run: |
49+
pip install git-cliff
50+
51+
- name: Generate changelog
52+
id: generate_changelog
53+
run: |
54+
git-cliff --output CHANGELOG.md --bump
55+
new_version=$(git-cliff --bumped-version)
56+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
57+
58+
- name: Create Pull Request
59+
uses: peter-evans/create-pull-request@v7
60+
with:
61+
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
62+
committer: PasteurBot <${{ vars.PL_PASTEURBOT_EMAIL }}>
63+
author: PasteurBot <${{ vars.PL_PASTEURBOT_EMAIL }}>
64+
commit-message: "chore: update changelog"
65+
title: "chore: 🚢 release ${{ steps.generate_changelog.outputs.new_version }}"
66+
branch: bot/release/${{ steps.generate_changelog.outputs.new_version }}
67+
draft: false
68+
base: main
69+
add-paths: CHANGELOG.md
70+
body: |
71+
This PR contains the generated changelog for the release ${{ steps.generate_changelog.outputs.new_version }}.
72+
73+
⚠️ **Merging this PR will immediately trigger a new release**. ⚠️
74+
75+
To specify additional release notes, please edit this comment after the following line.
76+
77+
---
78+
79+
update-pr:
80+
runs-on: ubuntu-latest
81+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/bot/release/')
82+
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
with:
87+
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
88+
fetch-depth: 0
89+
fetch-tags: true
90+
91+
- name: Set up Python
92+
uses: actions/setup-python@v5
93+
with:
94+
python-version-file: "pyproject.toml"
95+
96+
- name: Install git-cliff
97+
run: |
98+
pip install git-cliff
99+
100+
- name: Generate changelog
101+
id: generate_changelog
102+
run: |
103+
git-cliff --output CHANGELOG.md --bump
104+
new_version=$(git-cliff --bumped-version)
105+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
106+
107+
- name: Update PR with changelog
108+
run: |
109+
git config --global user.name "PasteurBot"
110+
git config --global user.email "${{ vars.PL_PASTEURBOT_EMAIL }}"
111+
112+
git add CHANGELOG.md
113+
114+
if git diff --cached --quiet; then
115+
echo "No changes to commit"
116+
else
117+
git commit -m "chore: update changelog before release"
118+
git push origin HEAD:${{ github.ref }}
119+
fi
120+
121+
release:
122+
runs-on: ubuntu-latest
123+
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'bot/release/')
124+
125+
steps:
126+
- name: Checkout code
127+
uses: actions/checkout@v4
128+
with:
129+
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
130+
ref: ${{ github.event.pull_request.merge_commit_sha }}
131+
fetch-depth: 0
132+
fetch-tags: true
133+
134+
- name: Set up Python
135+
uses: actions/setup-python@v5
136+
with:
137+
python-version-file: "pyproject.toml"
138+
139+
- name: Install git-cliff
140+
run: |
141+
pip install git-cliff
142+
143+
- name: Get version numbers
144+
id: get_version
145+
run: |
146+
current_version=$(gh release view --json tagName --jq '.tagName' || echo "v0.0.0")
147+
echo "current_version=$current_version" >> $GITHUB_OUTPUT
148+
149+
new_version=$(git-cliff --bumped-version)
150+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
151+
152+
- name: Assemble release notes
153+
id: release_notes
154+
env:
155+
PR_BODY: ${{ github.event.pull_request.body }}
156+
run: |
157+
changelog=$(git-cliff --unreleased --bump --latest --strip all)
158+
# Strip off first line (which is the version number)
159+
changelog=$(printf "%s" "$changelog" | sed '1d')
160+
161+
# Get custom notes from the PR body
162+
custom_notes="$PR_BODY"
163+
# Fix line endings
164+
custom_notes=$(echo "$custom_notes" | tr -d '\r')
165+
# Keep only the part after the first '---' line
166+
custom_notes=$(echo "$custom_notes" | sed -n '/^---$/,$p' | sed '1d')
167+
# Strip leading / trailing whitespace
168+
custom_notes=$(echo "$custom_notes" | sed 's/^[ \t]*//;s/[ \t]*$//')
169+
170+
# Create the release notes file
171+
touch /tmp/notes.md
172+
echo "# Release ${{ steps.get_version.outputs.new_version }}" > /tmp/notes.md
173+
if [[ -n "$custom_notes" ]]; then
174+
printf "%s\n\n" "$custom_notes" >> /tmp/notes.md
175+
fi
176+
printf "## What's Changed\n%s\n" "$changelog" >> /tmp/notes.md
177+
178+
# Append link to full diff
179+
echo -e "\n**Full diff**: https://github.com/${{ github.repository }}/compare/${{ steps.get_version.outputs.current_version }}...${{ steps.get_version.outputs.new_version }}" >> /tmp/notes.md
180+
181+
echo "release_note_file=/tmp/notes.md" >> $GITHUB_OUTPUT
182+
183+
- name: Create new release
184+
run: |
185+
gh release create "${{ steps.get_version.outputs.new_version }}" \
186+
--title "${{ steps.get_version.outputs.new_version }}" \
187+
--notes-file "${{ steps.release_notes.outputs.release_note_file }}" \
188+
--target ${{ github.event.pull_request.merge_commit_sha }} \
189+
--latest

CONTRIBUTING.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ reports and feature requests only.
3333

3434
## Documentation
3535

36-
Tesseract documentation is kept under the `docs/` directory of the repository,
36+
Tesseract-JAX documentation is kept under the `docs/` directory of the repository,
3737
written in Markdown and using Sphinx to generate the final HTMLs. Fixes and
3838
enhancements to the documentation should be submitted as pull requests, we
3939
treat the same as code contributions.
@@ -58,9 +58,11 @@ those posted elsewhere already) are best highlighted and celebrated in the
5858

5959
## Code
6060

61-
Tesseract is developed under the [Apache 2.0](LICENSE) license. By contributing
62-
to the Tesseract project you agree that your code contributions are governed by
63-
this license.
61+
Tesseract-JAX is developed under the [Apache 2.0](LICENSE) license. By contributing
62+
to the Tesseract-JAX project you agree that your code contributions are governed by
63+
this license. We require you to sign our [Contributor License
64+
Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md)
65+
to state so.
6466

6567

6668
### Local development setup
@@ -71,7 +73,7 @@ clone the repository, install the dependencies, and setup pre-commit hooks:
7173

7274
```console
7375
$ git clone [email protected]:pasteurlabs/tesseract-jax.git
74-
$ cd tesseract
76+
$ cd tesseract-jax
7577
$ python -m venv venv
7678
$ . venv/bin/activate
7779
$ pip install -e .[dev]
@@ -138,11 +140,11 @@ _description_: `type[(scope)]: description`. The types we use are:
138140
- `test`: for adding new tests or fixing existing ones.
139141

140142
The scopes we use are:
141-
- `cli`: for changes that affect `tesseract` CLI.
143+
- `cli`: for changes that affect CLI.
142144
- `engine`: for changes that affect the CLI engine.
143-
- `sdk`: for changes that affect the Tesseract Python API.
145+
- `sdk`: for changes that affect the Python API.
144146
- `example`: for changes in the examples.
145-
- `runtime`: for changes in the Tesseract Runtime.
147+
- `runtime`: for changes in the runtime.
146148
- `deps`: for changes in the dependencies.
147149

148150
In case there are breaking changes in your code, this should be indicated in
@@ -152,12 +154,19 @@ or by adding a `BREAKING CHANGE:` trailer to the message.
152154

153155
## Versioning
154156

155-
The Tesseract project follows [semantic versioning](https://semver.org).
157+
The Tesseract-JAX project follows [semantic versioning](https://semver.org).
156158

157159

158-
## Changelog
160+
## Release process
161+
(code owners only)
159162

160-
This project [changelog](CHANGELOG.md) is generated by
161-
[git-cliff](https://git-cliff.org). The changelog is generated by running
162-
`git cliff --output CHANGELOG.md`. To bump the semantic version of the project
163-
when generating the changelog: `git cliff --output CHANGELOG.md --bump`.
163+
Releases are done via GitHub Actions, which automatically build the release
164+
artifacts and publish them to the [GitHub Releases](https://github.com/pasteurlabs/tesseract-jax/releases) page. To create a new release, follow these steps:
165+
166+
1. Make sure the code is in a good state, all tests pass, and the documentation is up to date.
167+
2. Trigger a new release action through the [GitHub UI](https://github.com/pasteurlabs/tesseract-jax/actions/workflows/release.yml). This opens a new pull request with the release notes and the version number.
168+
3. Add any additional release notes to the pull request message. They will automatically be included at the top of the release notes.
169+
4. In the meantime, you can add more commits to `main` (and update the release branch) which will trigger re-generation of the changelog and release notes.
170+
5. Once the pull request is ready, merge it into `main`.
171+
6. GitHub Actions will then automatically release the new version. Verify that the release artifacts are correctly built and published.
172+
7. Make an announcement in the [Discourse Forum](https://si-tesseract.discourse.group/) and on social media, if applicable.

0 commit comments

Comments
 (0)