Skip to content

Commit

Permalink
Update GH Action and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
praveek committed Dec 1, 2023
1 parent 0eb43aa commit bee1ff2
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 217 deletions.
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
97 changes: 42 additions & 55 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@ name: Publish Release
on:
workflow_dispatch:
inputs:
release_core:
required: false
type: boolean
default: false
description: Release Core

release_identity:
required: false
type: boolean
default: false
description: Release Identity

release_lifecycle:
required: false
type: boolean
default: false
description: Release Lifecycle

release_signal:
required: false
type: boolean
default: false
description: Release Signal
extension:
type: choice
description: Extension to release
options:
- core
- identity
- lifecycle
- signal

tag:
description: 'tag/version'
required: true

action_tag:
description: 'Create tag? ("no" to skip)'
required: true
default: 'yes'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
ref: main

- name: Set up Java
uses: actions/setup-java@v1
with:
Expand All @@ -43,6 +40,24 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Verify versions
run: |
set -eo pipefail
echo Release version: ${{ github.event.inputs.tag }}
(./scripts/versions.sh -n ${{ github.event.inputs.extension }} -v ${{ github.event.inputs.tag }})
- name: Create GH Release
id: create_release
uses: release-drafter/release-drafter@v5
if: ${{ github.event.inputs.action_tag == 'yes' }}
with:
name: v${{ github.event.inputs.tag }}-${{ github.event.inputs.extension }}
tag: v${{ github.event.inputs.tag }}-${{ github.event.inputs.extension }}
version: v${{ github.event.inputs.tag }}-${{ github.event.inputs.extension }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Import GPG key
env:
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
Expand All @@ -51,38 +66,10 @@ jobs:
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes
- name: Publish Core to maven central repository
if: ${{ inputs.release_core }}
run: make core-publish-main
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}

- name: Publish Identity to maven central repository
if: ${{ inputs.release_identity }}
run: make identity-publish-main
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}

- name: Publish Lifecycle to maven central repository
if: ${{ inputs.release_lifecycle }}
run: make lifecycle-publish-main
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}

- name: Publish Signal to maven central repository
if: ${{ inputs.release_signal }}
run: make signal-publish-main
- name: Publish to maven central repository
run: make ${{ github.event.inputs.extension }}-publish-main
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
17 changes: 5 additions & 12 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,33 @@ on:
signal-version:
description: 'New version to use for Signal. Example: 3.0.2'
required: false

branch:
description: 'Branch to be used when updating versions'
required: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
update-versions:
runs-on: macos-latest
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.branch }}

- if: ${{ github.event.inputs.core-version != '' }}
name: Update Core Version
run: (sh ./scripts/update-versions.sh -n Core -v ${{ github.event.inputs.core-version }})
run: (sh ./scripts/versions.sh -u -n Core -v ${{ github.event.inputs.core-version }})

- if: ${{ github.event.inputs.identity-version != '' }}
name: Update Identity Version
run: (sh ./scripts/update-versions.sh -n Identity -v ${{ github.event.inputs.identity-version }})
run: (sh ./scripts/versions.sh -u -n Identity -v ${{ github.event.inputs.identity-version }})

- if: ${{ github.event.inputs.lifecycle-version != '' }}
name: Update Lifecycle Version
run: (sh ./scripts/update-versions.sh -n Lifecycle -v ${{ github.event.inputs.lifecycle-version }})
run: (sh ./scripts/versions.sh -u -n Lifecycle -v ${{ github.event.inputs.lifecycle-version }})

- if: ${{ github.event.inputs.signal-version != '' }}
name: Update Signal Version
run: (sh ./scripts/update-versions.sh -n Signal -v ${{ github.event.inputs.signal-version }})
run: (sh ./scripts/versions.sh -u -n Signal -v ${{ github.event.inputs.signal-version }})

- name: Generate Commit Message
shell: bash
Expand Down Expand Up @@ -88,4 +82,3 @@ jobs:
commit-message: Update versions ${{ env.COMMIT_MSG }}
title: Update versions ${{ env.COMMIT_MSG }}
body: Update versions ${{ env.COMMIT_MSG }}
base: ${{ github.event.inputs.branch }}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ import kotlin.test.assertTrue

@RunWith(MockitoJUnitRunner.Silent::class)
class MobileCoreTests {

private var EXTENSION_VERSION = "2.5.0"

@Mock
private lateinit var mockedEventHub: EventHub

Expand All @@ -56,12 +53,6 @@ class MobileCoreTests {
reset(mockedEventHub)
}

@Test
fun testSDKVersion() {
EventHub.shared = EventHub()
assertEquals(EXTENSION_VERSION, MobileCore.extensionVersion())
}

@Test
fun testDispatchEventSimple() {
val event = Event.Builder("test", "analytics", "requestContent").build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.adobe.marketing.mobile.EventSource
import com.adobe.marketing.mobile.EventType
import com.adobe.marketing.mobile.ExtensionApi
import com.adobe.marketing.mobile.ExtensionHelper
import com.adobe.marketing.mobile.MobileCore
import com.adobe.marketing.mobile.SharedStateResolver
import com.adobe.marketing.mobile.internal.configuration.ConfigurationExtension.Companion.CONFIGURATION_REQUEST_CONTENT_CLEAR_UPDATED_CONFIG
import com.adobe.marketing.mobile.internal.configuration.ConfigurationExtension.Companion.CONFIGURATION_REQUEST_CONTENT_IS_INTERNAL_EVENT
Expand Down Expand Up @@ -60,8 +61,6 @@ import kotlin.test.assertTrue
@RunWith(MockitoJUnitRunner.Silent::class)
class ConfigurationExtensionTests {

private var EXTENSION_VERSION = "2.5.0"

@Mock
private lateinit var mockServiceProvider: ServiceProvider

Expand Down Expand Up @@ -120,7 +119,8 @@ class ConfigurationExtensionTests {
mockConfigurationRulesManager
)

Assert.assertEquals(EXTENSION_VERSION, configurationExtension.extensionVersion)
// Configuration version must make the SDK version
Assert.assertEquals(MobileCore.extensionVersion(), configurationExtension.extensionVersion)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@

@RunWith(MockitoJUnitRunner.Silent.class)
public class IdentityAPITests {
private static final String EXTENSION_VERSION = "2.0.3";

@Test
public void test_extensionVersion() {
assertEquals(EXTENSION_VERSION, Identity.extensionVersion());
}

@Test
public void test_syncIdentifier() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.adobe.marketing.mobile.Event
import com.adobe.marketing.mobile.EventSource
import com.adobe.marketing.mobile.EventType
import com.adobe.marketing.mobile.ExtensionApi
import com.adobe.marketing.mobile.Identity
import com.adobe.marketing.mobile.MobilePrivacyStatus
import com.adobe.marketing.mobile.SharedStateResult
import com.adobe.marketing.mobile.SharedStateStatus
Expand Down Expand Up @@ -56,7 +57,6 @@ import java.util.concurrent.CountDownLatch

@RunWith(MockitoJUnitRunner.Silent::class)
class IdentityExtensionTests {
private var EXTENSION_VERSION = "2.0.3"

private val appendToUrlEvent = Event.Builder("AppendToUrlRequest", EventType.IDENTITY, EventSource.REQUEST_IDENTITY).setEventData(
mapOf(
Expand Down Expand Up @@ -111,7 +111,7 @@ class IdentityExtensionTests {
@Test
fun `get extension version`() {
val identityExtension = initializeSpiedIdentityExtension()
assertEquals(EXTENSION_VERSION, identityExtension.version)
assertEquals(Identity.extensionVersion(), identityExtension.version)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
@RunWith(MockitoJUnitRunner.Silent.class)
public class LifecycleAPITests {

private static final String EXTENSION_VERSION = "2.0.4";

@Test
public void test_extensionVersion() {
assertEquals(EXTENSION_VERSION, Lifecycle.extensionVersion());
}

@Test
public void test_extensionClass() {
assertEquals(LifecycleExtension.class, Lifecycle.EXTENSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.adobe.marketing.mobile.Event;
import com.adobe.marketing.mobile.ExtensionApi;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.SharedStateResolution;
import com.adobe.marketing.mobile.SharedStateResult;
import com.adobe.marketing.mobile.SharedStateStatus;
Expand All @@ -37,9 +38,6 @@

@RunWith(MockitoJUnitRunner.Silent.class)
public class LifecycleExtensionTests {

private static final String EXTENSION_VERSION = "2.0.4";

@Mock ExtensionApi extensionApi;

@Mock NamedCollection lifecycleDataStore;
Expand Down Expand Up @@ -94,7 +92,7 @@ public void testGetFriendlyName() {

@Test
public void testGetVersion() {
assertEquals(EXTENSION_VERSION, lifecycle.getVersion());
assertEquals(Lifecycle.extensionVersion(), lifecycle.getVersion());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
@RunWith(MockitoJUnitRunner.Silent.class)
public class SignalAPITests {

private static final String EXTENSION_VERSION = "2.0.1";

@Test
public void test_extensionVersion() {
assertEquals(EXTENSION_VERSION, Signal.extensionVersion());
}

@Test
public void test_extensionClass() {
assertEquals(SignalExtension.class, Signal.EXTENSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.adobe.marketing.mobile.Extension
import com.adobe.marketing.mobile.ExtensionApi
import com.adobe.marketing.mobile.ExtensionEventListener
import com.adobe.marketing.mobile.ExtensionHelper
import com.adobe.marketing.mobile.Signal
import com.adobe.marketing.mobile.services.PersistentHitQueue
import com.adobe.marketing.mobile.util.SQLiteUtils
import org.junit.Assert.assertEquals
Expand All @@ -38,7 +39,6 @@ import org.mockito.junit.MockitoJUnitRunner
class SignalExtensionTests {
private lateinit var signalExtension: Extension
private lateinit var extensionApi: ExtensionApi
private var EXTENSION_VERSION = "2.0.1"

companion object {
@BeforeClass
Expand Down Expand Up @@ -113,7 +113,7 @@ class SignalExtensionTests {

@Test
fun `Test getVersion() `() {
assertEquals(EXTENSION_VERSION, ExtensionHelper.getVersion(signalExtension))
assertEquals(Signal.extensionVersion(), ExtensionHelper.getVersion(signalExtension))
}

@Test
Expand Down
Loading

0 comments on commit bee1ff2

Please sign in to comment.