Skip to content

Commit b802ca4

Browse files
authored
chore: update CI (#29)
* chore: run pre-commit * chore: update CI scripts * chore: update CI for tests
1 parent 78e92f0 commit b802ca4

13 files changed

+124
-43
lines changed

.github/workflows/full-release.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
post_version_spec:
1313
description: "Post Version Specifier"
1414
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
1519
since:
1620
description: "Use PRs with activity since this date or git reference"
1721
required: false
@@ -23,44 +27,69 @@ on:
2327
description: "Comma separated list of steps to skip during Populate Release"
2428
required: false
2529
jobs:
26-
full_release:
30+
prep_release:
2731
runs-on: ubuntu-latest
2832
permissions:
29-
# This is useful if you want to use PyPI trusted publisher
30-
# and NPM provenance
31-
id-token: write
33+
contents: write
3234
steps:
3335
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
3436

3537
- name: Prep Release
3638
id: prep-release
3739
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
3840
with:
39-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
41+
token: ${{ secrets.GITHUB_TOKEN }}
4042
version_spec: ${{ github.event.inputs.version_spec }}
43+
# silent: ${{ github.event.inputs.silent }}
4144
post_version_spec: ${{ github.event.inputs.post_version_spec }}
45+
target: ${{ github.event.inputs.target }}
4246
branch: ${{ github.event.inputs.branch }}
4347
since: ${{ github.event.inputs.since }}
4448
since_last_stable: ${{ github.event.inputs.since_last_stable }}
4549

50+
publish_release:
51+
needs: [prep_release]
52+
runs-on: ubuntu-latest
53+
environment: release
54+
permissions:
55+
id-token: write
56+
steps:
57+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
58+
59+
- uses: actions/create-github-app-token@v1
60+
id: app-token
61+
with:
62+
app-id: ${{ vars.APP_ID }}
63+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
64+
4665
- name: Populate Release
4766
id: populate-release
4867
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
4968
with:
50-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
69+
token: ${{ steps.app-token.outputs.token }}
70+
target: ${{ github.event.inputs.target }}
5171
branch: ${{ github.event.inputs.branch }}
52-
release_url: ${{ steps.prep-release.outputs.release_url }}
72+
release_url: ${{ github.event.inputs.release_url }}
5373
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
5474

5575
- name: Finalize Release
5676
id: finalize-release
57-
uses: jupyter-server/jupyter-releaser/.github/actions/finalize-release@v2
77+
env:
78+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
79+
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
5880
with:
59-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
81+
token: ${{ steps.app-token.outputs.token }}
82+
target: ${{ github.event.inputs.target }}
6083
release_url: ${{ steps.populate-release.outputs.release_url }}
6184

6285
- name: "** Next Step **"
6386
if: ${{ success() }}
6487
run: |
6588
echo "Verify the final release"
6689
echo ${{ steps.finalize-release.outputs.release_url }}
90+
91+
- name: "** Failure Message **"
92+
if: ${{ failure() }}
93+
run: |
94+
echo "Failed to Publish the Draft Release Url:"
95+
echo ${{ steps.populate-release.outputs.release_url }}

.github/workflows/prep-release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
post_version_spec:
1313
description: "Post Version Specifier"
1414
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
1519
since:
1620
description: "Use PRs with activity since this date or git reference"
1721
required: false
@@ -22,15 +26,18 @@ on:
2226
jobs:
2327
prep_release:
2428
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
2531
steps:
2632
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
2733

2834
- name: Prep Release
2935
id: prep-release
3036
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
3137
with:
32-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
38+
token: ${{ secrets.GITHUB_TOKEN }}
3339
version_spec: ${{ github.event.inputs.version_spec }}
40+
# silent: ${{ github.event.inputs.silent }}
3441
post_version_spec: ${{ github.event.inputs.post_version_spec }}
3542
branch: ${{ github.event.inputs.branch }}
3643
since: ${{ github.event.inputs.since }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Publish Changelog"
2+
on:
3+
release:
4+
types: [published]
5+
6+
workflow_dispatch:
7+
inputs:
8+
branch:
9+
description: "The branch to target"
10+
required: false
11+
12+
jobs:
13+
publish_changelog:
14+
runs-on: ubuntu-latest
15+
environment: release
16+
steps:
17+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
18+
19+
- uses: actions/create-github-app-token@v1
20+
id: app-token
21+
with:
22+
app-id: ${{ vars.APP_ID }}
23+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
24+
25+
- name: Publish changelog
26+
id: publish-changelog
27+
uses: jupyter-server/jupyter_releaser/.github/actions/publish-changelog@v2
28+
with:
29+
token: ${{ steps.app-token.outputs.token }}
30+
branch: ${{ github.event.inputs.branch }}
31+
32+
- name: "** Next Step **"
33+
run: |
34+
echo "Merge the changelog update PR: ${{ steps.publish-changelog.outputs.pr_url }}"

.github/workflows/publish-release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,34 @@ on:
1515
jobs:
1616
publish_release:
1717
runs-on: ubuntu-latest
18+
environment: release
1819
permissions:
19-
# This is useful if you want to use PyPI trusted publisher
20-
# and NPM provenance
2120
id-token: write
2221
steps:
2322
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
2423

24+
- uses: actions/create-github-app-token@v1
25+
id: app-token
26+
with:
27+
app-id: ${{ vars.APP_ID }}
28+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
29+
2530
- name: Populate Release
2631
id: populate-release
2732
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
2833
with:
29-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
34+
token: ${{ steps.app-token.outputs.token }}
3035
branch: ${{ github.event.inputs.branch }}
3136
release_url: ${{ github.event.inputs.release_url }}
3237
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
3338

3439
- name: Finalize Release
3540
id: finalize-release
36-
uses: jupyter-server/jupyter-releaser/.github/actions/finalize-release@v2
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
3744
with:
38-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
45+
token: ${{ steps.app-token.outputs.token }}
3946
release_url: ${{ steps.populate-release.outputs.release_url }}
4047

4148
- name: "** Next Step **"

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python-version: ["3.7", "3.8", "3.9", "3.10"]
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2222

2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v5
2727
with:
2828
python-version: ${{ matrix.python-version }}
29+
cache: 'pip' # caching pip dependencies
2930
- name: Install dependencies
3031
run: |
3132
pip install -e . --group test

.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v2.3.0
44
hooks:
5-
- id: check-yaml
6-
- id: end-of-file-fixer
7-
- id: trailing-whitespace
8-
- repo: https://github.com/psf/black
9-
rev: 22.8.0
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/psf/black
9+
rev: 25.1.0
1010
hooks:
11-
- id: black
12-
- repo: https://github.com/pycqa/isort
13-
rev: 5.10.1
11+
- id: black
12+
- repo: https://github.com/pycqa/isort
13+
rev: 6.0.1
1414
hooks:
1515
- id: isort
1616
name: isort
17-
- repo: https://github.com/pycqa/flake8
18-
rev: 5.0.4
17+
- repo: https://github.com/pycqa/flake8
18+
rev: 7.3.0
1919
hooks:
20-
- id: flake8
20+
- id: flake8

hatch_nodejs_version/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: 2022-present Angus Hollands <[email protected]>
22
#
33
# SPDX-License-Identifier: MIT
4-
from ._version import __version__
4+
from ._version import __version__ # noqa: F401

hatch_nodejs_version/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# SPDX-License-Identifier: MIT
44
from hatchling.plugin import hookimpl
55

6-
from .version_source import NodeJSVersionSource
76
from .metadata_source import NodeJSMetadataHook
7+
from .version_source import NodeJSVersionSource
88

99

1010
@hookimpl

hatch_nodejs_version/metadata_source.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import os.path
88
import re
99
import urllib.parse
10-
from typing import Any, Union
10+
from typing import Any
1111

1212
from hatchling.metadata.plugin.interface import MetadataHookInterface
1313

14-
AUTHOR_PATTERN = r"^(?P<name>[^<(]+?)?[ \t]*(?:<(?P<email>[^>(]+?)>)?[ \t]*(?:\((?P<url>[^)]+?)\)|$)"
14+
AUTHOR_PATTERN = (
15+
r"^(?P<name>[^<(]+?)?[ \t]*(?:<(?P<email>[^>(]+?)>)?[ \t]*(?:\((?P<url>[^)]+?)\)|$)"
16+
)
1517
REPOSITORY_PATTERN = r"^(?:(gist|bitbucket|gitlab|github):)?(.*?)$"
1618
REPOSITORY_TABLE = {
1719
"gitlab": "https://gitlab.com",

hatch_nodejs_version/version_source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,5 @@ def set_version(self, version: str, version_data):
166166
data["version"] = self.python_version_to_node(version)
167167
with open(path, "w") as f:
168168
json.dump(data, f, indent=4)
169-
if raw_data.endswith('\n'):
170-
f.write('\n')
169+
if raw_data.endswith("\n"):
170+
f.write("\n")

0 commit comments

Comments
 (0)