Skip to content

Commit

Permalink
Setup PyPI deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
m-dzianishchyts committed Oct 1, 2024
1 parent ac71a42 commit 369502f
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 14 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'deploy to PyPI'

on:
push:
tags:
- '[0-9]+.[0-9]+.?[ab]?[0-9]+'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Install build dependencies
run: pip install build

- name: Build
env:
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_jjava: ${{ github.ref_name }}
run: |
mvn clean verify -U
python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: distributions
path: dist/

deploy:
name: Deploy to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/jjava
permissions:
id-token: write

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/

- name: Deploy distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
java: [ 11, 17, 21 ]

steps:
- name: Checkout...
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK...
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'

- name: Build and test...
- name: Build and test
run: mvn clean verify -U
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'create release'
on:
push:
tags:
- '[0-9]+.[0-9]+*'
- '[0-9]+.[0-9]+.?[ab]?[0-9]+'

permissions:
# allow a write access to GitHub Releases
Expand All @@ -19,27 +19,27 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- name: Checkout...
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK...
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Build...
- name: Build
run: mvn clean package

- name: Set version...
- name: Set version
id: vars
run: |
RELEASE_TAG=${GITHUB_REF#refs/*/}
echo "tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
echo "version=${RELEASE_TAG}" >> $GITHUB_OUTPUT
- name: Create release...
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion kernelspec/java/kernel.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"{resource_dir}/jjava.jar",
"{connection_file}"
],
"display_name": "Java",
"display_name": "Java (jjava)",
"language": "java",
"interrupt_mode": "message",
"env": {
Expand Down
3 changes: 0 additions & 3 deletions pip/jjava/setup.py

This file was deleted.

6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"

[project]
name = "jjava"
version = "1.0+SNAPSHOT"
requires-python = ">=3.8"
description = "A Jupyter kernel for Java notebooks"
authors = [
Expand All @@ -21,6 +20,7 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows"
]
dynamic = ["version"]

[project.urls]
Documentation = "https://dflib.org/jjava/docs/1.x/"
Expand All @@ -31,6 +31,10 @@ Changelog = "https://github.com/dflib/jjava/blob/main/RELEASE-NOTES.md"

[tool.setuptools.packages.find]
where = ["pip"]
include = ["jjava"]

[tool.setuptools_scm]
version_file = "pip/jjava/_version.py"

[tool.setuptools.data-files]
"share/jupyter/kernels/java" = ["kernelspec/java/*"]

0 comments on commit 369502f

Please sign in to comment.