forked from growthbook/growthbook-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
build: rebase Nelo publishing overlay onto upstream 0.11.0 #2
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
Open
elliotmjackson
wants to merge
2
commits into
main
Choose a base branch
from
nelo-publish-0.11.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| if has nix; then | ||
| if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then | ||
| source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" | ||
| fi | ||
| fi | ||
|
|
||
| source_env_if_exists .envrc.local |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Publish to GitHub Packages | ||
|
|
||
| # Manually triggered release of the GrowthBook SDK artifact to our GitHub | ||
| # Packages Maven registry. | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| neloBuild: | ||
| description: 'Nelo re-cut number; version becomes <upstream version>-nelo.<N>' | ||
| required: true | ||
| default: '1' | ||
| version: | ||
| description: 'Optional full version override; leave blank to derive from the tag' | ||
| required: false | ||
| default: '' | ||
| modules: | ||
| description: 'Gradle publish tasks to run' | ||
| required: true | ||
| default: ':lib:publish' | ||
| type: choice | ||
| options: | ||
| - ':lib:publish' | ||
| - 'publish' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| # Use exact JDK versions pinned with nix | ||
| - uses: DeterminateSystems/nix-installer-action@main | ||
|
|
||
| # The version normally derives from the checked-out tag's gradle.properties plus the | ||
| # -nelo.<N> suffix the root build.gradle appends, so it always matches the code being | ||
| # built. `version` is upstream's own project property, so the optional override needs | ||
| # no patched file; the overlay vendor-qualifies it either way. | ||
| - name: Publish to GitHub Packages | ||
| run: | | ||
| nix develop --command bash -c './gradlew ${{ inputs.modules }} \ | ||
| -PneloBuild="${{ inputs.neloBuild }}" \ | ||
| ${{ inputs.version != '' && format('-Pversion="{0}"', inputs.version) || '' }} \ | ||
| --console=plain --stacktrace' | ||
| env: | ||
| GITHUB_ACTOR: ${{ github.actor }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,5 @@ build | |
| bin | ||
| .vscode | ||
| .DS_Store | ||
|
|
||
| /.direnv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| ".": "0.10.10" | ||
| ".": "0.11.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Nelo fork overlay. | ||
| * | ||
| * Upstream has no root build script, so everything fork-specific lives here and every | ||
| * upstream file — lib/build.gradle, gradle.properties, the cache adapter modules — stays | ||
| * byte-identical. That keeps syncing with upstream a fast-forward instead of a merge. | ||
| * | ||
| * Upstream already declares a `GitHubPackages` publishing repository (and reads | ||
| * GITHUB_ACTOR / GITHUB_TOKEN from the environment); it just points at its own registry. | ||
| * We only redirect the URL to ours. | ||
| * | ||
| * WHY THIS FORK EXISTS: upstream does not publish com.github.growthbook:lib to Maven | ||
| * Central, and JitPack 403s in CI. So we rebuild upstream's tagged release unchanged and | ||
| * republish it to our own GitHub Packages registry, letting api-v2 consume it as a binary | ||
| * instead of building the SDK from source. No SDK behaviour is forked -- if upstream ever | ||
| * ships to Maven Central, this repo can be retired. | ||
| */ | ||
|
|
||
| // Every artifact we publish is vendor-qualified as <upstream version>-nelo.<N>, so a Nelo | ||
| // rebuild can never be mistaken for -- or collide with -- a genuine upstream release, and | ||
| // we can re-cut the same upstream version (.2, .3) if a build needs redoing. The base | ||
| // version tracks upstream's gradle.properties, so it cannot go stale on the next sync. | ||
| // Re-cut with -PneloBuild=2; an explicit -Pversion=x.y.z-nelo.N is passed through as-is. | ||
| def neloBuild = findProperty('neloBuild') ?: '1' | ||
|
|
||
| gradle.beforeProject { p -> | ||
| def v = p.version.toString() | ||
| if (v != 'unspecified' && !v.contains('-nelo.')) { | ||
| p.version = "${v}-nelo.${neloBuild}" | ||
| } | ||
| } | ||
|
|
||
| subprojects { | ||
| // Upstream's gradle.properties sets `group=com.github.growthbook ` with a trailing | ||
| // space. lib/build.gradle reassigns the group so it escapes, but the cache adapter | ||
| // modules inherit it and Gradle rejects the publication outright: | ||
| // "groupId (com.github.growthbook ) is not a valid Maven identifier". | ||
| // Trim it here so `./gradlew publish` works for every module. | ||
| group = group.toString().trim() | ||
|
|
||
| plugins.withId('maven-publish') { | ||
| publishing.repositories.withType(MavenArtifactRepository).all { repo -> | ||
| if (repo.name == 'GitHubPackages') { | ||
| repo.url = uri('https://maven.pkg.github.com/nelo/growthbook-sdk-java') | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package-write workflow executes
DeterminateSystems/nix-installer-action@mainandactions/checkout@v4, so those references can later resolve to unreviewed code and make releases non-reproducible or expose the job token. Pin both actions to reviewed full commit SHAs.How this was verified: Both mutable references execute before Gradle in a job granted
packages: write.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!