Skip to content

Commit 07860a7

Browse files
authored
Merge pull request #214 from blink1073/refactor
Cleanup Docs and Base Setup Action
2 parents 44aaf9d + d1ba65b commit 07860a7

File tree

3 files changed

+17
-131
lines changed

3 files changed

+17
-131
lines changed

.github/actions/common/action.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,8 @@ description: "Common Actions to Set up Releaser"
33
runs:
44
using: "composite"
55
steps:
6-
- name: Install Python
7-
uses: actions/setup-python@v2
8-
with:
9-
python-version: 3.9
10-
architecture: "x64"
11-
12-
- name: Install node
13-
uses: actions/setup-node@v2
14-
with:
15-
node-version: "14.x"
16-
17-
- name: Get pip cache dir
18-
shell: bash
19-
id: pip-cache
20-
run: |
21-
echo "::set-output name=dir::$(pip cache dir)"
22-
23-
- name: Cache pip
24-
uses: actions/cache@v2
25-
with:
26-
path: ${{ steps.pip-cache.outputs.dir }}
27-
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
28-
restore-keys: |
29-
${{ runner.os }}-pip-
30-
${{ runner.os }}-pip-
31-
32-
- name: Print env
33-
shell: bash
34-
run: env
35-
36-
- name: Upgrade packaging dependencies
37-
shell: bash
38-
run: |
39-
pip install --upgrade pip setuptools wheel --user
40-
6+
- name: Base Setup
7+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
418
- name: Install Dependencies
429
shell: bash
4310
run: |

README.md

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -21,90 +21,7 @@ To install the latest release locally, make sure you have
2121

2222
## Checklist for Adoption
2323

24-
A. Prep the `jupyter_releaser` fork:
25-
26-
- [ ] Clone this repository onto your GitHub user account.
27-
- [ ] Add a [GitHub Access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with access to target GitHub repo to run GitHub Actions, saved as
28-
`ADMIN_GITHUB_TOKEN` in the [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
29-
- [ ] Add access token for the [PyPI registry](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github) stored as `PYPI_TOKEN`.
30-
_Note_ For security reasons, it is recommended that you scope the access
31-
to a single repository, and use a variable called `PYPI_TOKEN_MAP` that is formatted as follows:
32-
33-
```
34-
owner1/repo1,token1
35-
owner2/repo2,token2
36-
```
37-
38-
- [ ] If needed, add access token for [npm](https://docs.npmjs.com/creating-and-viewing-access-tokens), saved as `NPM_TOKEN`.
39-
40-
B. Prep target repository:
41-
42-
- [ ] Switch to Markdown Changelog
43-
- We recommend [MyST](https://myst-parser.readthedocs.io/en/latest/?badge=latest), especially if some of your docs are in reStructuredText.
44-
- Can use `pandoc -s changelog.rst -o changelog.md` and some hand edits as needed.
45-
- Note that [directives](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#syntax-directives) can still be used
46-
- [ ] Add HTML start and end comment markers to Changelog file - see example in [CHANGELOG.md](./CHANGELOG.md) (view in raw mode)
47-
- [ ] Add [tbump](https://github.com/tankerhq/tbump) support if using Python - see example metadata in [pyproject.toml](./pyproject.toml)
48-
- We recommend putting `setuptools` metadata in `setup.cfg` and using `version attr: <package_name>.__version__`, see example [`setup.cfg`](./setup.cfg)
49-
- See documentation on `setup.cfg` [metadata](https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html)
50-
- If previously providing `version_info`, use a snippet like the one below, since `tbump` requires the intact version string, e.g.
51-
52-
```python
53-
import re
54-
55-
# Version string must appear intact for tbump versioning
56-
__version__ = '1.4.0.dev0'
57-
58-
# Build up version_info tuple for backwards compatibility
59-
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
60-
match = re.match(pattern, __version__)
61-
parts = [int(match[part]) for part in ['major', 'minor', 'patch']]
62-
if match['rest']:
63-
parts.append(match['rest'])
64-
version_info = tuple(parts)
65-
```
66-
67-
- [ ] Add a GitHub Actions CI step to run the `check_release` action. For example:
68-
69-
```yaml
70-
- name: Check Release
71-
if: ${{ matrix.python-version == '3.9' }}
72-
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
73-
with:
74-
token: ${{ secrets.GITHUB_TOKEN }}
75-
```
76-
77-
_Note_ The check release action needs `contents: write` [permission](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#modifying-the-permissions-for-the-github_token).
78-
79-
- [ ] If you would like the release assets to be uploaded as artifacts, add the following step after the `check_release` action:
80-
81-
```yaml
82-
- name: Upload Distributions
83-
uses: actions/upload-artifact@v2
84-
with:
85-
name: jupyter-releaser-dist-${{ github.run_number }}
86-
path: .jupyter_releaser_checkout/dist
87-
```
88-
89-
- [ ] Update or add `RELEASE.md` that describes the onboarding and release process, e.g.
90-
91-
```markdown
92-
# Release Workflow
93-
94-
- [ ] Set up a fork of `jupyter-releaser` if you have not yet done so.
95-
- [ ] Run through the release process, targeting this repo and the appropriate branch
96-
```
97-
98-
- [ ] Optionally add [configuration](#Configuration) to the target repository if non-standard options or hooks are needed.
99-
- [ ] If desired, add `check_release` job, changelog, and `tbump` support to other active release branches
100-
- [ ] Try out the `Draft Changelog` and `Draft Release` process against a fork of the target repo first so you don't accidentally push tags and GitHub releases to the source repository.
101-
- [ ] Try the `Publish Release` process using a prerelease version before publishing a final version.
102-
103-
## Backport Branches
104-
105-
- Create backport branches the usual way, e.g. `git checkout -b 3.0.x v3.0.1; git push origin 3.0.x`
106-
- When running the `Publish Release` Workflow, an automatic PR is generated for the default branch
107-
in the target repo, positioned in the appropriate place in the changelog.
24+
See the [adoption docs](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo.html).
10825

10926
## Workflows
11027

docs/source/how_to_guides/convert_repo.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,20 @@ B. Prep target repository:
4747
- [ ] Add [tbump](https://github.com/tankerhq/tbump) support if using Python - see example metadata in [pyproject.toml](https://github.com/jupyter-server/jupyter_releaser/blob/master/pyproject.toml)
4848
- We recommend putting `setuptools` metadata in `setup.cfg` and using `version attr: <package_name>.__version__`, see example [`setup.cfg`](https://github.com/jupyter-server/jupyter_releaser/blob/master/setup.cfg)
4949
- See documentation on `setup.cfg` [metadata](https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html)
50-
- If previously providing `version_info`, use a snippet like the one below, since `tbump` requires the intact version string, e.g.
50+
- If previously providing `version_info` like `version_info = (1, 7, 0, '.dev', '0')`, use tbump config like the one below:
5151

52-
```python
53-
import re
52+
```toml
53+
[[tool.tbump.file]]
54+
src = "jupyter_server/_version.py"
55+
version_template = '({major}, {minor}, {patch}, "{channel}", "{release}")'
5456

55-
# Version string must appear intact for tbump versioning
56-
__version__ = '1.4.0.dev0'
57+
[[tool.tbump.field]]
58+
name = "channel"
59+
default = ""
5760

58-
# Build up version_info tuple for backwards compatibility
59-
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
60-
match = re.match(pattern, __version__)
61-
parts = [int(match[part]) for part in ['major', 'minor', 'patch']]
62-
if match['rest']:
63-
parts.append(match['rest'])
64-
version_info = tuple(parts)
61+
[[tool.tbump.field]]
62+
name = "release"
63+
default = ""
6564
```
6665

6766
- [ ] Add a GitHub Actions CI step to run the `check_release` action. For example:
@@ -86,6 +85,9 @@ _Note_ The check release action needs `contents: write` [permission](https://doc
8685
path: .jupyter_releaser_checkout/dist
8786
```
8887

88+
- [ ] Add a workflow that uses the [`enforce-label`](https://github.com/jupyterlab/maintainer-tools#enforce-labels) action from `jupyterlab/maintainer-tools` to ensure that all PRs have on of the triage labels used to
89+
categorize the changelog.
90+
8991
- [ ] Update or add `RELEASE.md` that describes the onboarding and release process, e.g.
9092

9193
## Release Workflow

0 commit comments

Comments
 (0)