Skip to content

Commit

Permalink
fix(scripts): kotlin release (#2649)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Feb 2, 2024
1 parent d3784b6 commit d9c0caf
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ jobs:

codegen:
runs-on: ubuntu-22.04
timeout-minutes: 10
timeout-minutes: 15
needs:
- setup
- client_gen
Expand Down
13 changes: 6 additions & 7 deletions clients/algoliasearch-client-java/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ jobs:
name: Publish to Sonatype
runs-on: ubuntu-22.04
if: "startsWith(github.event.head_commit.message, 'chore: release')"
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:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -25,10 +19,15 @@ jobs:
with:
distribution: zulu
java-version-file: .java-version
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache
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 }}
2 changes: 1 addition & 1 deletion clients/algoliasearch-client-java/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

repositories {
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/repositories/" }
mavenCentral()
}

Expand Down
17 changes: 2 additions & 15 deletions clients/algoliasearch-client-kotlin/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
publish:
name: Publish to Sonatype
runs-on: macos-13
if: "startsWith(github.event.head_commit.message, 'chore: release')"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -22,25 +23,11 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Compile
run: ./gradlew assemble

- name: Upload Artifacts
run: ./gradlew publish
run: ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache
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 }}

- name: Check Snapshot
id: snapshot
run: |
if [[ $(cat ./gradle.properties | grep 'VERSION_NAME=.*-SNAPSHOT') ]]; then
echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT
fi
- name: Release Artifacts
if: ${{ steps.snapshot.outputs.IS_SNAPSHOT != 'true' }}
run: ./gradlew closeAndReleaseRepository
2 changes: 1 addition & 1 deletion scripts/ci/codegen/pushSpecsToNewWorldDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function pushToNewWorld(): Promise<void> {
const tempGitDir = resolve(process.env.RUNNER_TEMP!, repository);
await fsp.rm(tempGitDir, { force: true, recursive: true });
await run(`git clone --depth 1 ${githubURL} ${tempGitDir}`);
await run(`git checkout -B ${targetBranch}`);
await run(`git checkout -B ${targetBranch}`, { cwd: tempGitDir });

const dest = toAbsolutePath(`${tempGitDir}/apps/docs/public/specs`);
await emptyDirExceptForDotGit(dest);
Expand Down
5 changes: 3 additions & 2 deletions scripts/ci/codegen/waitForAllReleases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getAllRuns(languages: Language[], workflowIDs: Array<number | undefined
}

// check that the run was created less than 10 minutes ago
if (Date.now() - Date.parse(ciRun.data.workflow_runs[0].created_at) > 10 * 60 * 1000) {
if (Date.now() - Date.parse(ciRun.data.workflow_runs[0].created_at) > 15 * 60 * 1000) {
return null;
}

Expand Down Expand Up @@ -79,7 +79,8 @@ async function waitForAllReleases(languages: Language[]): Promise<void> {
const failures: Language[] = [];

const start = Date.now();
while (Date.now() - start < 1000 * 60 * 5) {
// kotlin release can take a long time
while (Date.now() - start < 1000 * 60 * 10) {
const runs = await getAllRuns(languages, workflowIDs);
for (let i = 0; i < languages.length; i++) {
if (runs[i] === null) {
Expand Down
1 change: 1 addition & 0 deletions scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export function toAbsolutePath(ppath: string): string {
export async function gitCommit({
message,
coAuthors,
// the cwd must be absolute !
cwd = ROOT_DIR,
}: {
message: string;
Expand Down

0 comments on commit d9c0caf

Please sign in to comment.