Skip to content

Commit

Permalink
Added CI job for test PyPI publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverbus committed Sep 4, 2024
1 parent 4d88ed3 commit 7e8518f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,32 @@ jobs:
PGP_KEY: ${{ secrets.PGP_KEY }}
PGP_PWD: ${{ secrets.PGP_PWD }}

github-release:
pypi-publish:
runs-on: ubuntu-latest
needs: build
# Release job, only for pushes to the main development branch
if: github.event_name == 'push'
&& github.ref == 'refs/heads/master'
&& github.repository == 'linkedin/isolation-forest'
&& !contains(toJSON(github.event.commits.*.message), '[skip release]')
steps:
- name: Check out code
uses: actions/checkout@v2 # https://github.com/actions/checkout
with:
fetch-depth: '0'
- name: Setup Python
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
with:
python-version: '3.9'
- name: Publish to PyPI
run: ./gradlew publishPythonPackageToTestPyPI
env:
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}

github-release:
runs-on: ubuntu-latest
needs: ['build', 'pypi-publish']
# Release job, only for pushes to the main development branch
if: github.event_name == 'push'
&& github.ref == 'refs/heads/master'
&& github.repository == 'linkedin/isolation-forest'
Expand All @@ -96,3 +118,4 @@ jobs:
run: ./gradlew githubRelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

5 changes: 2 additions & 3 deletions isolation-forest-onnx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ task buildPythonPackage(type: Exec) {
commandLine "${venvDir}/bin/python", 'setup.py', 'sdist', 'bdist_wheel'
}

// Task to publish the Python package to PyPI
task publishPythonPackage(type: Exec) {
description = 'Upload the Python package to PyPI'
group = 'upload'
group = 'publishing'

dependsOn buildPythonPackage
environment 'TWINE_USERNAME', '__token__'
Expand All @@ -43,7 +42,7 @@ task publishPythonPackage(type: Exec) {

task publishPythonPackageToTestPyPI(type: Exec) {
description = 'Upload the Python package to Test PyPI'
group = 'upload'
group = 'publishing'

dependsOn buildPythonPackage
environment 'TWINE_USERNAME', '__token__'
Expand Down

0 comments on commit 7e8518f

Please sign in to comment.