Skip to content

Commit 5aecc5a

Browse files
java and ruby release method (#234)
1 parent af9e015 commit 5aecc5a

File tree

7 files changed

+49
-47
lines changed

7 files changed

+49
-47
lines changed

.github/workflows/build-java.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ jobs:
3535
path: ./libs
3636
- name: Build with Gradle
3737
run: |
38-
./devops/BuildJava.ps1 -GitTag ${{ github.ref }} -TestOutput "test_output.xml" -ArtifactName "${{ matrix.os-artifact[1] }}"
38+
python ../devops/build_sdks.py --github-token=${{ secrets.API_GITHUB_TOKEN }}
39+
gradle build
3940
shell: pwsh
41+
working-directory: java
4042
- name: Upload Unit Test Results - Java
4143
if: always()
4244
uses: actions/upload-artifact@v2

.github/workflows/build-ruby.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ jobs:
3232
workflow: "build-libs.yml"
3333
path: ./libs
3434
- name: Build and run tests
35-
run: ./devops/BuildRuby.ps1 -GitTag ${{ github.ref }} -TestOutput "test_output.xml" -ArtifactName "${{ matrix.os-artifact[1] }}"
35+
run: |
36+
gem install bundler
37+
gem install rspec
38+
bundle install
39+
python ../devops/build_sdks.py --github-token=${{ secrets.API_GITHUB_TOKEN }}
40+
bundle exec rake
41+
rake test
3642
shell: pwsh
43+
working-directory: ruby
3744
- name: Upload Unit Test Results - Ruby
3845
if: always()
3946
uses: actions/upload-artifact@v2

.github/workflows/release-java.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ name: Release Java Maven Package
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches: [ main ]
5+
# release:
6+
# types: [published]
7+
workflow_run:
8+
workflows: ["Release Platform Libraries"]
9+
branches: [main, "v?.*"]
10+
types:
11+
- completed
712

813
jobs:
914
build:

.github/workflows/release-python.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232
python ../devops/build_sdks.py --github-token=${{ secrets.API_GITHUB_TOKEN }}
3333
python -m build --sdist --wheel --outdir dist/ .
3434
shell: pwsh
35-
with:
36-
path: python
35+
working-directory: python
3736
- name: Publish distribution 📦 to PyPI
3837
uses: pypa/gh-action-pypi-publish@master
3938
with:

.github/workflows/release-ruby.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: Release Ruby Gem
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: 'Package version - SemVer compliant [N!]N(.N)*[{a|b|rc}N]'
8-
required: true
9-
default: ' '
10-
push:
11-
branches: [ main ]
5+
# release:
6+
# types: [published]
7+
workflow_run:
8+
workflows: ["Release Platform Libraries"]
9+
branches: [main, "v?.*"]
10+
types:
11+
- completed
1212

1313
jobs:
1414
build:
@@ -30,9 +30,14 @@ jobs:
3030
workflow: "build-libs.yml"
3131
path: ./libs
3232
branch: main
33-
- name: Install dependencies
34-
run: ./devops/BuildRuby.ps1 -GitTag "${{ github.ref }}" -PackageVersion "${{ github.event.inputs.version }}"
33+
- name: Build and run tests
34+
run: |
35+
gem install bundler
36+
bundle install
37+
python ../devops/build_sdks.py --github-token=${{ secrets.API_GITHUB_TOKEN }}
38+
gem build *.gemspec
3539
shell: pwsh
40+
working-directory: ruby
3641
- name: Publish gem
3742
uses: dawidd6/[email protected]
3843
with:

devops/BuildJava.ps1

Lines changed: 0 additions & 32 deletions
This file was deleted.

devops/build_sdks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ def build_python(args) -> None:
4747
copy_okapi_libs(join(python_dir, 'okapi', 'libs'))
4848

4949

50+
def build_java(args) -> None:
51+
# Update version in setup.cfg
52+
java_dir = abspath(join(dirname(__file__), '..', 'java'))
53+
update_line(join(java_dir, 'build.gradle'),
54+
{'def jarVersion': f'def jarVersion = {get_github_version(args.github_token)}'})
55+
56+
57+
def build_ruby(args) -> None:
58+
# Update version in setup.cfg
59+
ruby_dir = abspath(join(dirname(__file__), '..', 'ruby'))
60+
update_line(join(ruby_dir, 'lib', 'version.rb'),
61+
{' VERSION =': f' VERSION = {get_github_version(args.github_token)}'})
62+
# Copy in the binaries
63+
copy_okapi_libs(join(ruby_dir, 'libs'))
64+
65+
5066
def get_github_version(github_token: str = None) -> str:
5167
github_release_request = requests.get('https://api.github.com/repos/trinsic-id/okapi/releases/latest',
5268
headers={'Authorization': github_token})

0 commit comments

Comments
 (0)