-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure release to PyPI and Homebrew (#48)
* Setup PyPI deployment * Switch to real PyPI index * Tweak kernelspec assembly * Trigger `pip` release on github release publishing * Line break moment * Remove deployment environment * Return missing SCM * Setup Homebrew release * Fix metadata injection * Update Homebrew release target * New line moment
- Loading branch information
1 parent
e993dac
commit a1e5a64
Showing
8 changed files
with
154 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: 'prepare release' | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.?[ab]?[0-9]+' | ||
permissions: | ||
# allow a write access to GitHub Releases | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- 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: Collect the release distributions | ||
run: | | ||
mkdir -p release/ | ||
cp jjava/target/jjava-${{ github.ref_name }}-kernelspec.zip release/ | ||
cp -r dist/* release/ | ||
- name: Store the release distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-distributions | ||
path: release/ | ||
if-no-files-found: error | ||
|
||
prepare-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
|
||
steps: | ||
- name: Download distributions | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: release-distributions | ||
path: release/ | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
body: JJava ${{ github.ref_name }} release | ||
draft: true | ||
prerelease: false | ||
files: release/* | ||
fail_on_unmatched_files: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,66 @@ | ||
name: 'create release' | ||
name: 'release packages' | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+*' | ||
|
||
permissions: | ||
# allow a write access to GitHub Releases | ||
contents: write | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
prepare-release: | ||
release-pypi: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
tag: ${{ steps.vars.outputs.tag }} | ||
version: ${{ steps.vars.outputs.version }} | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout... | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK... | ||
uses: actions/setup-java@v4 | ||
- name: Download release assets | ||
uses: robinraju/release-downloader@v1 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
tag: ${{ github.ref_name }} | ||
fileName: jjava-!(kernelspec)*@(.tar.gz|.whl) | ||
out-file-path: dist/ | ||
|
||
- name: Build... | ||
run: mvn clean package | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: ${{ runner.debug }} | ||
|
||
- name: Set version... | ||
id: vars | ||
run: | | ||
RELEASE_TAG=${GITHUB_REF#refs/*/} | ||
echo "tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT | ||
echo "version=${RELEASE_TAG}" >> $GITHUB_OUTPUT | ||
release-homebrew: | ||
runs-on: ubuntu-latest | ||
|
||
- name: Create release... | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
steps: | ||
- name: Publish package to Homebrew | ||
uses: m-dzianishchyts/brewtap@v1 | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag }} | ||
body: JJava ${{ steps.vars.outputs.version }} release | ||
draft: true | ||
prerelease: false | ||
files: ./jjava/target/jjava-${{ steps.vars.outputs.version }}.zip | ||
fail_on_unmatched_files: true | ||
homebrew_owner: dflib | ||
homebrew_tap: homebrew-tap | ||
version: ${{ github.ref_name }} | ||
depends_on: | | ||
"jupyterlab" | ||
"expect" => :test | ||
target: jjava-${{ github.ref_name }}-kernelspec.zip | ||
install: | | ||
libexec.install Dir["*.jar"] | ||
config = buildpath/"kernel.json" | ||
inreplace config, "{resource_dir}", libexec | ||
system "jupyter kernelspec install #{buildpath} --config=#{config} --sys-prefix --name=java" | ||
test: | | ||
jupyter = Formula["jupyterlab"].opt_bin/"jupyter" | ||
assert_match " java ", shell_output("#{jupyter} kernelspec list") | ||
(testpath/"console.exp").write <<~EOS | ||
spawn #{jupyter} console --kernel=java | ||
expect -timeout 30 "In " | ||
send "System.out.println(\\\"Hello world!\\\");\r" | ||
expect -timeout 10 "In " | ||
send "\u0004" | ||
expect -timeout 10 "exit" | ||
send "y\r" | ||
EOS | ||
output = shell_output("expect -f console.exp") | ||
assert_match "JJava kernel #{version}", output | ||
assert_match "Hello world!", output | ||
caveats: | | ||
Although JJava doesn't depend on java, it requires jre>=11 to run. | ||
Make sure you have one in your PATH. | ||
update_readme_table: true | ||
github_token: ${{ secrets.HOMEBREW_RELEASE_ACCESS_TOKEN }} | ||
debug: ${{ runner.debug }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"version": "@version@", | ||
"project": "@project@" | ||
} | ||
"version": "${project.version}", | ||
"project": "${project.artifactId}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters