Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(java): release process (take 2) APIC-411 #422

Merged
merged 6 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.0.5.2
8.0.9
82 changes: 37 additions & 45 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,29 @@ runs:
)}}

# Restore Java clients: used during 'cts' or 'codegen'
- name: Restore Java client gradle properties
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' || (inputs.job == 'client' && inputs.language == 'java') }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2/gradle.properties
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'specs/bundled/search.yml',
'templates/java/**',
'generators/src/**'
)}}

- name: Restore built Java search client
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/SearchClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/SearchClient.java',
'clients/algoliasearch-client-java-2/model/search/**',
'specs/bundled/search.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -395,12 +408,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/RecommendClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/RecommendClient.java',
'clients/algoliasearch-client-java-2/model/recommend/**',
'specs/bundled/recommend.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -410,12 +423,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/PersonalizationClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/personalization/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/PersonalizationClient.java',
'clients/algoliasearch-client-java-2/model/personalization/**',
'specs/bundled/personalization.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -425,12 +438,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/AnalyticsClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/analytics/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/AnalyticsClient.java',
'clients/algoliasearch-client-java-2/model/analytics/**',
'specs/bundled/analytics.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -440,12 +453,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/InsightsClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/insights/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/Insights.java',
'clients/algoliasearch-client-java-2/model/insights/**',
'specs/bundled/insights.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -455,12 +468,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/AbtestingClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/abtesting/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/AbtestingClient.java',
'clients/algoliasearch-client-java-2/model/abtesting/**',
'specs/bundled/abtesting.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -470,12 +483,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/QuerySuggestionsClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/querySuggestions/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/QuerySuggestionsClient.java',
'clients/algoliasearch-client-java-2/model/querySuggestions/**',
'specs/bundled/query-suggestions.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -485,12 +498,12 @@ runs:
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
uses: actions/cache@v2
with:
path: clients/algoliasearch-client-java-2
path: |
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/api/PredictClient.java
clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/predict/**
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-java-2/api/PredictClient.java',
'clients/algoliasearch-client-java-2/model/predict/**',
'specs/bundled/predict.yml',
'templates/java/**',
'generators/src/**'
Expand All @@ -507,9 +520,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/SearchClient.php',
'clients/algoliasearch-client-php/lib/Configuration/SearchConfig.php',
'clients/algoliasearch-client-php/lib/Model/Search/**',
'specs/bundled/search.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -525,9 +535,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/RecommendClient.php',
'clients/algoliasearch-client-php/lib/Configuration/RecommendConfig.php',
'clients/algoliasearch-client-php/lib/Model/Recommend/**',
'specs/bundled/recommend.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -543,9 +550,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/PersonalizationClient.php',
'clients/algoliasearch-client-php/lib/Configuration/PersonalizationConfig.php',
'clients/algoliasearch-client-php/lib/Model/Personalization/**',
'specs/bundled/personalization.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -561,9 +565,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/AnalyticsClient.php',
'clients/algoliasearch-client-php/lib/Configuration/AnalyticsConfig.php',
'clients/algoliasearch-client-php/lib/Model/Analytics/**',
'specs/bundled/analytics.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -579,9 +580,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/InsightsClient.php',
'clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php',
'clients/algoliasearch-client-php/lib/Model/Insights/**',
'specs/bundled/insights.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -597,9 +595,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/AbtestingClient.php',
'clients/algoliasearch-client-php/lib/Configuration/AbtestingConfig.php',
'clients/algoliasearch-client-php/lib/Model/Abtesting/**',
'specs/bundled/abtesting.yml',
'templates/php/**',
'generators/src/**'
Expand All @@ -615,9 +610,6 @@ runs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
'clients/algoliasearch-client-php/lib/Api/QuerySuggestionsClient.php',
'clients/algoliasearch-client-php/lib/Configuration/QuerySuggestionsConfig.php',
'clients/algoliasearch-client-php/lib/Model/QuerySuggestions/**',
'specs/bundled/query-suggestions.yml',
'templates/php/**',
'generators/src/**'
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
id: cache
uses: actions/cache@v2
with:
path: ${{ matrix.client.bundledPath }}
path: ${{ format('specs/bundled/{0}.yml', matrix.client.name) }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still prefer manipulations in the TS file 😇

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okiii will do it later :(

key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
Expand Down Expand Up @@ -220,12 +220,12 @@ jobs:
id: cache
uses: actions/cache@v2
with:
path: ${{ matrix.client.path }}
path: |
${{ format('{0}/algoliasearch-core/src/com/algolia/api/{1}.java', matrix.client.path, matrix.client.api) }}
${{ format('{0}/{1}/**', matrix.client.path, matrix.client.capitalizedName) }}
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
format('{0}/{1}/**', matrix.client.path, matrix.client.name),
format('{0}/model/{1}/**', matrix.client.path, matrix.client.name),
format('specs/bundled/{0}.yml', matrix.client.name),
'templates/java/**',
'generators/src/**'
Expand Down Expand Up @@ -275,9 +275,6 @@ jobs:
key: |
${{ env.CACHE_VERSION }}-${{
hashFiles(
format('{0}/lib/Api/{1}.php', matrix.client.path, matrix.client.api),
format('{0}/lib/Configuration/{1}.php', matrix.client.path, matrix.client.config),
format('{0}/lib/Model/{1}/**', matrix.client.path, matrix.client.capitalizedName),
format('specs/bundled/{0}.yml', matrix.client.name),
'templates/php/**',
'generators/src/**'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish jar

on:
push:
branches:
- next

jobs:
release:
name: Publish to Sonatype
runs-on: ubuntu-20.04
if: "startsWith(github.event.head_commit.message, 'chore: release v')"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PRIVATE_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v2

- name: Install Java
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11.0.4
cache: gradle

- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Upload Artifacts
run: ./gradlew clean publish --no-parallel --stacktrace

- name: Release Artifacts
if: ! cat ./gradle.properties | grep 'VERSION_NAME=.*-SNAPSHOT'
run: ./gradlew closeAndReleaseRepository
1 change: 0 additions & 1 deletion clients/algoliasearch-client-java-2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.mtj.tmp/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been unstaged 🤔


# Package Files #
*.jar
*.war
*.ear

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

api/**
docs/**
gradle/**
src/**
README.md

.travis.yml
build.sbt
gradle.properties
git_push.sh
pom.xml
gradle*
gradlew.bat

# Selective source file
algoliasearch-core/src/com/algolia/auth/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'com.vanniktech.maven.publish'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was my last name ahaha

}

group = '{{groupId}}'
version = '{{artifactVersion}}'
description = 'algoliasearch-client-java-2'
java.sourceCompatibility = JavaVersion.VERSION_1_8

Expand All @@ -20,22 +18,14 @@ dependencies {
implementation 'io.gsonfire:gson-fire:1.8.5'
}

publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

sourceSets {
main {
java {
srcDirs = ["{{{sourceFolder}}}"]
srcDirs = ["src"]
}
}
}
Loading