From 1f5d9fb026033758477299f93e28b2f48aa50685 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 20 Nov 2022 06:46:17 -0600 Subject: [PATCH 1/5] switch to using jupyter releaser --- .github/workflows/release_publish.yml | 50 --------------------------- RELEASING.md | 17 +++++---- 2 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/release_publish.yml diff --git a/.github/workflows/release_publish.yml b/.github/workflows/release_publish.yml deleted file mode 100644 index a2bb1667..00000000 --- a/.github/workflows/release_publish.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Create Release and publish package - -on: - push: - tags: - - "**" - -jobs: - publish: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - name: Install dependencies - run: | - pip install pipx - - name: Build release - run: | - pipx run build . - pipx run twine check dist/* - - name: Parse tag - run: | - echo "RELEASE_TAG=$(python .github/scripts/parse_ref.py)" >> $GITHUB_ENV - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: ${{ env.RELEASE_TAG }} - name: Release ${{ env.RELEASE_TAG }} - artifacts: ${{ env.CURRENT_LOCALE_DIR }}/dist/* - body: Release ${{ env.RELEASE_TAG }} - token: ${{ secrets.GITHUB_TOKEN }} - - name: Publish PyPI Package - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: pipx run twine upload dist/* - - name: Create NPM configuration - run: python .github/scripts/create_npmrc.py - - name: Publish NPM Package - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish diff --git a/RELEASING.md b/RELEASING.md index 7cc011f4..229896ff 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,8 +2,6 @@ ## Prerequisites -- First check that the docs/changelog.rst is up to date for the next release version - - If you have a schema version change, you need to bump the schema version manually: First copy `nbformat/v4/nbformat/.v4.schema.json` to `nbformat/v4/nbformat/.v4.schema.json`. Then edit the top of `nbformat/v4/nbbase.py`: @@ -29,7 +27,14 @@ If you do one of these steps but not the others it will fail many tests. -## Update version +## Automated Release + +The recommended way to make a release is to use [`jupyter_releaser`](https://github.com/jupyter-server/jupyter_releaser) from this repository. + +- Run the "Step 1: Prep Release" workflow with the appropriate inputs. +- Review the changelog in the draft GitHub release created in Step 1. + +## Manual Release We use [hatch](https://hatch.pypa.io/latest/version/) to manage versions. @@ -48,12 +53,6 @@ git push upstream master git push upstream --tags ``` -## Publish packages - -PyPI and NPM packages will be built and published on CI when a tag is pushed. - -## Manual publish procedure - ### Push to PyPI ```bash From f4eedf9c4e6c461782ac7295948864d4a7c05930 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 20 Nov 2022 06:46:42 -0600 Subject: [PATCH 2/5] add workflows --- .github/workflows/enforce-label.yml | 13 +++++++ .github/workflows/prep-release.yml | 42 +++++++++++++++++++++ .github/workflows/publish-release.yml | 54 +++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 .github/workflows/enforce-label.yml create mode 100644 .github/workflows/prep-release.yml create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/enforce-label.yml b/.github/workflows/enforce-label.yml new file mode 100644 index 00000000..725feab5 --- /dev/null +++ b/.github/workflows/enforce-label.yml @@ -0,0 +1,13 @@ +name: Enforce PR label + +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] +jobs: + enforce-label: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: enforce-triage-label + uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1 diff --git a/.github/workflows/prep-release.yml b/.github/workflows/prep-release.yml new file mode 100644 index 00000000..7a2a18de --- /dev/null +++ b/.github/workflows/prep-release.yml @@ -0,0 +1,42 @@ +name: "Step 1: Prep Release" +on: + workflow_dispatch: + inputs: + version_spec: + description: "New Version Specifier" + default: "next" + required: false + branch: + description: "The branch to target" + required: false + post_version_spec: + description: "Post Version Specifier" + required: false + since: + description: "Use PRs with activity since this date or git reference" + required: false + since_last_stable: + description: "Use PRs with activity since the last stable git tag" + required: false + type: boolean +jobs: + prep_release: + runs-on: ubuntu-latest + steps: + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Prep Release + id: prep-release + uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + version_spec: ${{ github.event.inputs.version_spec }} + post_version_spec: ${{ github.event.inputs.post_version_spec }} + target: ${{ github.event.inputs.target }} + branch: ${{ github.event.inputs.branch }} + since: ${{ github.event.inputs.since }} + since_last_stable: ${{ github.event.inputs.since_last_stable }} + + - name: "** Next Step **" + run: | + echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}" diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..dbaaeaad --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,54 @@ +name: "Step 2: Publish Release" +on: + workflow_dispatch: + inputs: + branch: + description: "The target branch" + required: false + release_url: + description: "The URL of the draft GitHub release" + required: false + steps_to_skip: + description: "Comma separated list of steps to skip" + required: false + +jobs: + publish_release: + runs-on: ubuntu-latest + steps: + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Populate Release + id: populate-release + uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + target: ${{ github.event.inputs.target }} + branch: ${{ github.event.inputs.branch }} + release_url: ${{ github.event.inputs.release_url }} + steps_to_skip: ${{ github.event.inputs.steps_to_skip }} + + - name: Finalize Release + id: finalize-release + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }} + TWINE_USERNAME: __token__ + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + uses: jupyter-server/jupyter-releaser/.github/actions/finalize-release@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + target: ${{ github.event.inputs.target }} + release_url: ${{ steps.populate-release.outputs.release_url }} + + - name: "** Next Step **" + if: ${{ success() }} + run: | + echo "Verify the final release" + echo ${{ steps.finalize-release.outputs.release_url }} + + - name: "** Failure Message **" + if: ${{ failure() }} + run: | + echo "Failed to Publish the Draft Release Url:" + echo ${{ steps.populate-release.outputs.release_url }} From dba69b29630867223a53e96da4e78f8d4357a9f4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 20 Nov 2022 06:55:27 -0600 Subject: [PATCH 3/5] update workflow --- .github/workflows/tests.yml | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f9cf6d0b..de0bcd56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,7 @@ jobs: codecov - run: hatch version 100.100.100 - pre-commit: + pre_commit: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -115,3 +115,45 @@ jobs: steps: - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1 + + check_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Install Dependencies + run: | + pip install -e . + - name: Check Release + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + check_links: + name: Check Links + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 + + tests_check: # This job does nothing and is only used for the branch protection + if: always() + needs: + - tests + - pre_commit + - docs + - test_minimum_versions + - test_prereleases + - check_links + - check_release + - test_sdist + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} From 4e71b553190930516206eca7c2deb62ba4e8cd73 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 20 Nov 2022 06:59:21 -0600 Subject: [PATCH 4/5] update release workflow --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 398185e2..0a569bae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ (changelog)= + + # Changes in nbformat ## 5.7.0 @@ -7,6 +9,8 @@ - Always use jsonschema to handle error reporting. - Fix deprecation warning suggestion. + + ## 5.6.1 - Fix handling of `__version__` on Python 3.7. From 3d9b81c3fee352966bac1869f1f442489be74061 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 20 Nov 2022 07:20:40 -0600 Subject: [PATCH 5/5] fix link handling --- .github/workflows/tests.yml | 2 ++ README.md | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de0bcd56..b86a08ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -139,6 +139,8 @@ jobs: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 + with: + ignore_glob: "tests/*.ipynb" tests_check: # This job does nothing and is only used for the branch protection if: always() diff --git a/README.md b/README.md index ce8f0a4f..53e822d2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # The Jupyter Notebook Format [![codecov.io](https://codecov.io/github/jupyter/nbformat/coverage.svg?branch=master)](https://codecov.io/github/jupyter/nbformat?branch=master) -[![Code Health](https://landscape.io/github/jupyter/nbformat/master/landscape.svg?style=flat)](https://landscape.io/github/jupyter/nbformat/master) ![CI Tests](https://github.com/jupyter/nbformat/workflows/Run%20tests/badge.svg) `nbformat` contains the reference implementation of the [Jupyter Notebook format],