Skip to content
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
101 changes: 101 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish to Maven Central

on:
push:
branches: [ "main" ]

jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'ReforgeHQ/sdk-java'

steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven

- name: Extract version from pom.xml
id: extract_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Current version: $VERSION"

- name: Check if version exists in Maven Central
id: version_check
run: |
VERSION=${{ steps.extract_version.outputs.version }}
echo "Checking if version $VERSION exists in Maven Central..."

# Check if version exists (non-snapshot versions only)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://repo1.maven.org/maven2/com/reforge/sdk-parent/$VERSION/sdk-parent-$VERSION.pom")
if [ "$HTTP_STATUS" = "200" ]; then
echo "Version $VERSION already exists in Maven Central"
echo "should_publish=false" >> $GITHUB_OUTPUT
else
echo "Version $VERSION does not exist in Maven Central"
echo "should_publish=true" >> $GITHUB_OUTPUT
fi
else
echo "Snapshot version detected, skipping publication"
echo "should_publish=false" >> $GITHUB_OUTPUT
fi

- name: Import GPG key
if: steps.version_check.outputs.should_publish == 'true'
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Configure Maven settings
if: steps.version_check.outputs.should_publish == 'true'
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: |
[
{
"id": "ossrh",
"url": "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
]
servers: |
[
{
"id": "ossrh",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}
]

- name: Publish to Maven Central
if: steps.version_check.outputs.should_publish == 'true'
run: |
echo "Publishing version ${{ steps.extract_version.outputs.version }} to Maven Central..."
mvn clean deploy -P release --no-transfer-progress
env:
REFORGE_INTEGRATION_TEST_SDK_KEY: ${{ secrets.REFORGE_INTEGRATION_TEST_SDK_KEY }}
REFORGE_SDK_KEY: 1-fake-apikey
REFORGE_INTEGRATION_TEST_ENCRYPTION_KEY: "c87ba22d8662282abe8a0e4651327b579cb64a454ab0f4c170b45b15f049a221"
PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY: "c87ba22d8662282abe8a0e4651327b579cb64a454ab0f4c170b45b15f049a221"
NOT_A_NUMBER: "not a number"
IS_A_NUMBER: 1234

- name: Create GitHub Release
if: steps.version_check.outputs.should_publish == 'true'
uses: ncipollo/create-release@v1
with:
tag: "v${{ steps.extract_version.outputs.version }}"
name: "Release v${{ steps.extract_version.outputs.version }}"
generateReleaseNotes: true
draft: false
prerelease: ${{ contains(steps.extract_version.outputs.version, 'RC') || contains(steps.extract_version.outputs.version, 'beta') || contains(steps.extract_version.outputs.version, 'alpha') }}
39 changes: 0 additions & 39 deletions sdk/src/main/java/com/reforge/sdk/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.ImmutableSet;
import com.reforge.sdk.config.ConfigChangeListener;
import com.reforge.sdk.config.logging.LogLevelChangeListener;
import com.reforge.sdk.context.ContextSetReadable;
import com.reforge.sdk.context.ContextStore;
import com.reforge.sdk.internal.Internal;
Expand Down Expand Up @@ -47,11 +46,8 @@ public enum CollectContextMode {
PERIODIC_EXAMPLE,
}

private static final String DEFAULT_ENV = "default";

private String apikey;
private String configOverrideDir;
private List<String> prefabEnvs = new ArrayList<>();
private Datasources datasources = Datasources.ALL;
private int initializationTimeoutSec = 10;
private OnInitializationFailure onInitializationFailure = OnInitializationFailure.RAISE;
Expand All @@ -61,8 +57,6 @@ public enum CollectContextMode {

private final Set<ConfigChangeListener> changeListenerSet = new HashSet<>();

private final Set<LogLevelChangeListener> logLevelChangeListeners = new HashSet<>();

private boolean evaluatedConfigKeyUploadEnabled = true;

private boolean collectEvaluationSummaries = true;
Expand Down Expand Up @@ -170,23 +164,6 @@ public Options setStreamHosts(List<String> streamHosts) {
return this;
}

public List<String> getPrefabEnvs() {
return prefabEnvs;
}

/**
* Set the prefab environment names in order of increasing precedence
* Files named with the pattern `.prefab.%s.config.yaml` are loaded first with `default` then the supplied envs, in order
* This means a key in an env named later in the list will override the same key earlier in the list
* Files are loaded from the classpath first, then from the configured override directory
* @param prefabEnvs
* @return this
*/
public Options setPrefabEnvs(List<String> prefabEnvs) {
this.prefabEnvs = prefabEnvs;
return this;
}

public Datasources getPrefabDatasource() {
return datasources;
}
Expand Down Expand Up @@ -283,13 +260,6 @@ public Options setCollectEvaluationSummaries(boolean collectEvaluationSummaries)
return this;
}

public List<String> getAllPrefabEnvs() {
final List<String> envs = new ArrayList<>();
envs.add(DEFAULT_ENV);
envs.addAll(prefabEnvs);
return envs;
}

public String getApiKeyId() {
return getApikey().split("\\-")[0];
}
Expand All @@ -312,15 +282,6 @@ public Set<ConfigChangeListener> getChangeListeners() {
return ImmutableSet.copyOf(changeListenerSet);
}

public Options addLogLevelChangeListener(LogLevelChangeListener configChangeListener) {
logLevelChangeListeners.add(configChangeListener);
return this;
}

public Set<LogLevelChangeListener> getLogLevelChangeListeners() {
return ImmutableSet.copyOf(logLevelChangeListeners);
}

@Internal
public Options setTelemetryListener(@Nullable TelemetryListener telemetryListener) {
this.telemetryListener = telemetryListener;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading