From a45fc03615fbec7ca77427545ca609020ca0b9ed Mon Sep 17 00:00:00 2001 From: Manu Chaudhary Date: Sun, 24 May 2026 17:39:12 +0530 Subject: [PATCH 1/4] feat: initial stlc build Stainless-Generated-From: 1bb5c3d0172e2421143ac417119512c41453f137 --- .github/workflows/ci.yml | 43 +++----------------------------- .stats.yml | 3 --- release-please-config.json | 5 ++-- scripts/utils/upload-artifact.sh | 2 +- 4 files changed, 7 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5134aae..338c7a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,35 +21,16 @@ jobs: permissions: contents: read id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/imagekit-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: |- - github.repository == 'stainless-sdks/imagekit-go' && + github.repository == 'imagekit-developer/imagekit-go-staging' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Get GitHub OIDC Token - if: |- - github.repository == 'stainless-sdks/imagekit-go' && - !startsWith(github.ref, 'refs/heads/stl/') - id: github-oidc - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: core.setOutput('github_token', await core.getIDToken()); - - - name: Upload tarball - if: |- - github.repository == 'stainless-sdks/imagekit-go' && - !startsWith(github.ref, 'refs/heads/stl/') - env: - URL: https://pkg.stainless.com/s - AUTH: ${{ steps.github-oidc.outputs.github_token }} - SHA: ${{ github.sha }} - run: ./scripts/utils/upload-artifact.sh lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/imagekit-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: @@ -62,21 +43,3 @@ jobs: - name: Run lints run: ./scripts/lint - test: - timeout-minutes: 10 - name: test - runs-on: ${{ github.repository == 'stainless-sdks/imagekit-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Setup go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 - with: - go-version-file: ./go.mod - - - name: Bootstrap - run: ./scripts/bootstrap - - - name: Run tests - run: ./scripts/test diff --git a/.stats.yml b/.stats.yml index 45327aa..58526a7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1 @@ configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-01267e4c07ec30011b8445babed88fbd2133b65198f42d0310b7ab39c74751d4.yml -openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d -config_hash: 7ef70b333059ca21bef0f0a6d4cbb282 diff --git a/release-please-config.json b/release-please-config.json index a38198e..64bef1e 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,7 +2,7 @@ "packages": { ".": {} }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "include-v-in-tag": true, "include-component-in-tag": false, "versioning": "prerelease", @@ -62,6 +62,7 @@ "release-type": "go", "extra-files": [ "internal/version.go", - "README.md" + "README.md", + ".github/workflows/create-releases.yml" ] } \ No newline at end of file diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index cf87460..6a1c697 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -43,7 +43,7 @@ UPLOAD_RESPONSE=$(curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/imagekit-go/$SHA'. Run 'go mod edit -replace github.com/imagekit-developer/imagekit-go/v2=/path/to/unzipped_directory'.\033[0m" + echo -e "\033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/imagekit-go-staging/$SHA'. Run 'go mod edit -replace github.com/imagekit-developer/imagekit-go/v2=/path/to/unzipped_directory'.\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 From 8fe89e69a4183d39877f045edd4255bf95d9bc2c Mon Sep 17 00:00:00 2001 From: Manu Chaudhary Date: Mon, 25 May 2026 12:13:08 +0530 Subject: [PATCH 2/4] Promote SDKs from staging to production Stainless-Generated-From: 42e90eb2b2b3e97e58a8c1120333c6b3cf5b7d95 --- .github/workflows/stlc-promote.yml | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/stlc-promote.yml diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml new file mode 100644 index 0000000..0ca08a5 --- /dev/null +++ b/.github/workflows/stlc-promote.yml @@ -0,0 +1,65 @@ +name: Promote SDKs + +on: + push: + branches: [main] + +permissions: + contents: read + +jobs: + promote: + runs-on: ubuntu-latest + env: + PRODUCTION_REPO: imagekit-developer/imagekit-go + PRODUCTION_BRANCH: master + GH_TOKEN: ${{ secrets.SDK_WRITE_TOKEN }} + steps: + - name: Check out staging + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Fetch production main + run: | + git remote add production \ + "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" + git fetch production "${PRODUCTION_BRANCH}" + + - name: Check if production is already in sync + id: diff + run: | + STAGING_SHA=$(git rev-parse origin/main) + PRODUCTION_SHA=$(git rev-parse production/${PRODUCTION_BRANCH}) + if [ "$STAGING_SHA" = "$PRODUCTION_SHA" ]; then + echo "Production is already at $STAGING_SHA. Nothing to release." + echo "synced=true" >> "$GITHUB_OUTPUT" + else + echo "synced=false" >> "$GITHUB_OUTPUT" + fi + + - name: Push staging main to the release branch on production + if: steps.diff.outputs.synced == 'false' + run: | + git push production origin/main:refs/heads/stainless/release --force + + - name: Open or update the release PR on production + if: steps.diff.outputs.synced == 'false' + run: | + EXISTING_PR=$(gh pr list \ + --repo "${PRODUCTION_REPO}" \ + --head stainless/release \ + --state open \ + --json number \ + --jq '.[0].number') + if [ -z "${EXISTING_PR}" ]; then + gh pr create \ + --repo "${PRODUCTION_REPO}" \ + --base "${PRODUCTION_BRANCH}" \ + --head stainless/release \ + --title "Release SDK updates" \ + --body "$(git log --oneline production/${PRODUCTION_BRANCH}..origin/main)" + else + echo "Release PR #${EXISTING_PR} already exists. Force-push has updated it." + fi From d06d01ec3102cb88cbbc937f0ffea4d1ace7d832 Mon Sep 17 00:00:00 2001 From: Manu Chaudhary Date: Mon, 25 May 2026 13:17:29 +0530 Subject: [PATCH 3/4] Add release configuration Stainless-Generated-From: 1721b930f03bec529c2b286b232a9d84b030189b --- .github/workflows/release-please.yml | 20 ++++++++++++++++++++ release-please-config.json | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..c33f375 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,20 @@ +name: Release Please +on: + push: + branches: + - master + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + if: github.repository == 'imagekit-developer/imagekit-go' + runs-on: ubuntu-latest + + steps: + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 + id: release + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} diff --git a/release-please-config.json b/release-please-config.json index 64bef1e..dccefac 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -6,7 +6,7 @@ "include-v-in-tag": true, "include-component-in-tag": false, "versioning": "prerelease", - "prerelease": true, + "prerelease": false, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, "pull-request-header": "Automated Release PR", @@ -63,6 +63,6 @@ "extra-files": [ "internal/version.go", "README.md", - ".github/workflows/create-releases.yml" + ".github/workflows/release-please.yml" ] } \ No newline at end of file From 8e61f4b3135f9512964aadf23903711c03204143 Mon Sep 17 00:00:00 2001 From: Manu Chaudhary Date: Mon, 25 May 2026 15:02:44 +0530 Subject: [PATCH 4/4] ci: add sync-release-as workflow to mirror release PR title version Stainless-Generated-From: ade535986627a7c330589a914c3a99fc4a99d3d6 --- .github/workflows/sync-release-as.yml | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/sync-release-as.yml diff --git a/.github/workflows/sync-release-as.yml b/.github/workflows/sync-release-as.yml new file mode 100644 index 0000000..9915004 --- /dev/null +++ b/.github/workflows/sync-release-as.yml @@ -0,0 +1,63 @@ +name: Sync Release-As from release PR title + +on: + pull_request: + types: [edited] + +permissions: + contents: write + +jobs: + sync: + if: >- + github.event.pull_request.base.ref == 'master' && + startsWith(github.event.pull_request.head.ref, 'release-please--') && + github.event.changes.title != null + runs-on: ubuntu-latest + steps: + - name: Extract versions from old and new title + id: parse + env: + NEW_TITLE: ${{ github.event.pull_request.title }} + OLD_TITLE: ${{ github.event.changes.title.from }} + run: | + # Anchored on pull-request-title-pattern "release: ${version}" from release-please-config.json. + extract() { + echo "$1" | grep -oE '^release:[[:space:]]+v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?' \ + | sed -E 's/^release:[[:space:]]+v?//' + } + NEW_VERSION=$(extract "$NEW_TITLE") + OLD_VERSION=$(extract "$OLD_TITLE") + echo "old=$OLD_VERSION" + echo "new=$NEW_VERSION" + if [ -z "$NEW_VERSION" ]; then + echo "::notice::No semver in new title; nothing to do." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + if [ "$NEW_VERSION" = "$OLD_VERSION" ]; then + echo "::notice::Version unchanged ($NEW_VERSION); not pushing." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" + + - name: Check out master + if: steps.parse.outputs.skip != 'true' + uses: actions/checkout@v6 + with: + ref: master + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + fetch-depth: 1 + + - name: Push empty Release-As commit + if: steps.parse.outputs.skip != 'true' + env: + VERSION: ${{ steps.parse.outputs.version }} + run: | + git config user.name "release-as-bot" + git config user.email "release-as-bot@users.noreply.github.com" + git commit --allow-empty -m "chore: pin next release + + Release-As: ${VERSION}" + git push origin master