From 6ad6ceaf63f7b7c42318c3d51ba278d2986aaa49 Mon Sep 17 00:00:00 2001 From: Duc Trung Le Date: Wed, 6 Mar 2024 10:45:14 +0100 Subject: [PATCH 1/4] Add releaser workflow --- .github/workflows/check-release.yml | 35 +++++++++++++++++++ .github/workflows/prep-release.yml | 42 +++++++++++++++++++++++ .github/workflows/publish-release.yml | 49 +++++++++++++++++++++++++++ CHANGELOG.md | 5 +++ MANIFEST.in | 3 -- pyproject.toml | 33 ++++++++++++++++++ setup.py | 11 +----- tljh_repo2docker/__version__.py | 1 + 8 files changed, 166 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/check-release.yml create mode 100644 .github/workflows/prep-release.yml create mode 100644 .github/workflows/publish-release.yml create mode 100644 CHANGELOG.md delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml create mode 100644 tljh_repo2docker/__version__.py diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000..c239f65 --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,35 @@ +name: Check Release +on: + push: + branches: ['main'] + pull_request: + branches: ['*'] + +jobs: + check_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Conda environment with Micromamba + uses: mamba-org/setup-micromamba@v1 + with: + environment-name: cad + create-args: >- + python=3.10 + pip + jupyter-releaser + + - name: Check Release + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version_spec: next + shell: bash -l {0} + + - name: Upload Distributions + uses: actions/upload-artifact@v3 + with: + name: tljh_repo2docker-releaser-dist-${{ github.run_number }} + path: .jupyter_releaser_checkout/dist \ No newline at end of file diff --git a/.github/workflows/prep-release.yml b/.github/workflows/prep-release.yml new file mode 100644 index 0000000..8cefe8c --- /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 }}" \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..e7712f1 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,49 @@ +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 + permissions: + id-token: write + 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 }} + 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 + uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + 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 }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..45a7109 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# tljh-repo2docker Changelog + + + + diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 6884e83..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -recursive-include tljh_repo2docker/templates/ * -recursive-include tljh_repo2docker/static/ * -recursive-include tljh_repo2docker/tests/ * diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cfcdd81 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["hatchling>=1.5.0,<2"] +build-backend = "hatchling.build" + +[project] +name = "tljh-repo2docker" +dynamic = ["version"] +readme = "README.md" +license = { file = "LICENSE" } +dependencies = [ + "aiodocker~=0.19", + "dockerspawner~=12.1", + "jupyter_client~=6.1", + "sqlalchemy<2", +] + +[project.entry-points.tljh] +tljh_repo2docker = "tljh_repo2docker" + +[tool.hatch.version] +path = "tljh_repo2docker/__version__.py" + +[tool.hatch.build.targets.sdist] +include = ["/tljh_repo2docker"] + +[tool.jupyter-releaser.options] +version_cmd = "hatch version" + +[tool.jupyter-releaser.hooks] +before-bump-version = ["python -m pip install hatch"] + +[tool.check-wheel-contents] +ignore = ["W002"] diff --git a/setup.py b/setup.py index f0d62a7..54ce4b7 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1 @@ -from setuptools import setup, find_packages - -setup( - name="tljh-repo2docker", - version="0.0.1", - entry_points={"tljh": ["tljh_repo2docker = tljh_repo2docker"]}, - packages=find_packages(), - include_package_data=True, - install_requires=["dockerspawner~=12.1", "jupyter_client~=6.1", "aiodocker~=0.19", "sqlalchemy<2"], -) +__import__("setuptools").setup() \ No newline at end of file diff --git a/tljh_repo2docker/__version__.py b/tljh_repo2docker/__version__.py new file mode 100644 index 0000000..d538f87 --- /dev/null +++ b/tljh_repo2docker/__version__.py @@ -0,0 +1 @@ +__version__ = "1.0.0" \ No newline at end of file From 4ee4134da94722991aa7a9ae60e3f6bc12a3ffc4 Mon Sep 17 00:00:00 2001 From: Duc Trung Le Date: Wed, 6 Mar 2024 13:21:19 +0100 Subject: [PATCH 2/4] Use base setup --- .github/workflows/check-release.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index c239f65..992e48a 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -12,14 +12,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install Conda environment with Micromamba - uses: mamba-org/setup-micromamba@v1 - with: - environment-name: cad - create-args: >- - python=3.10 - pip - jupyter-releaser + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Check Release uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 From b449394db4766f608da3263b7060e4b63309c8de Mon Sep 17 00:00:00 2001 From: Duc Trung Le Date: Wed, 6 Mar 2024 15:31:46 +0100 Subject: [PATCH 3/4] Remove `ADMIN_GITHUB_TOKEN ` --- .github/workflows/prep-release.yml | 8 +++++++- .github/workflows/publish-release.yml | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prep-release.yml b/.github/workflows/prep-release.yml index 8cefe8c..7afdc9b 100644 --- a/.github/workflows/prep-release.yml +++ b/.github/workflows/prep-release.yml @@ -25,11 +25,17 @@ jobs: steps: - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Prep Release id: prep-release uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2 with: - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + token: ${{ steps.app-token.outputs.token }} version_spec: ${{ github.event.inputs.version_spec }} post_version_spec: ${{ github.event.inputs.post_version_spec }} target: ${{ github.event.inputs.target }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index e7712f1..35bc2ab 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -19,12 +19,18 @@ jobs: id-token: write steps: - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Populate Release id: populate-release uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2 with: - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + token: ${{ steps.app-token.outputs.token }} branch: ${{ github.event.inputs.branch }} release_url: ${{ github.event.inputs.release_url }} steps_to_skip: ${{ github.event.inputs.steps_to_skip }} @@ -33,7 +39,7 @@ jobs: id: finalize-release uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2 with: - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + token: ${{ steps.app-token.outputs.token }} release_url: ${{ steps.populate-release.outputs.release_url }} - name: '** Next Step **' From e8c491bf61ca312a780a1ca741fb0fe4bf016d55 Mon Sep 17 00:00:00 2001 From: Duc Trung Le Date: Fri, 8 Mar 2024 15:52:13 +0100 Subject: [PATCH 4/4] Switch from main to master --- .github/workflows/check-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 992e48a..2682994 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -1,7 +1,7 @@ name: Check Release on: push: - branches: ['main'] + branches: ['master'] pull_request: branches: ['*']