Skip to content

Commit

Permalink
fix: events are tracked to identified customer
Browse files Browse the repository at this point in the history
  • Loading branch information
levibostian authored Apr 29, 2022
1 parent 7dd7ada commit 71634ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 30 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Publish Snapshot builds

# Only run after a pull request has been merged into develop. This is because
# bot account runs write operations on the github repo to push a tag.
on:
push:
branches: [ develop ]
on: [pull_request]

jobs:
publish:
Expand All @@ -19,29 +15,11 @@ jobs:
distribution: adopt
java-version: 11

# Get just version number for semantic snapshot release. It would just dry run and not publish, release
- name: Run semantic release to get version
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
# version numbers below can be in many forms: M, M.m, M.m.p
semantic_version: 18
extra_plugins: |
@semantic-release/changelog@6
@semantic-release/git@10
@semantic-release/github@8
@semantic-release/exec@6
env:
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }}

- name: Release build
# assembleRelease for all modules, excluding non-library modules: app, docs
run: ./gradlew assembleRelease -x :app:assembleRelease
- name: Source jar and dokka
run: ./gradlew androidSourcesJar javadocJar

- name: Add MODULE_VERSION env property
run: echo "MODULE_VERSION=`echo ${{ steps.semantic.outputs.new_release_version }}`-SNAPSHOT" >> $GITHUB_ENV
# Using branch name for name of snapshot. Makes it easy to remember and can easily trigger new builds of Remote Habits.
- name: Set snapshot version
id: set-snapshot-version
# Get the current branch name and replace all / characters with - as / is invalid in gradle names.
run: echo "::set-output name=VERSION::$(echo '${{ github.event.pull_request.head.ref }}' | sed -r 's/\//-/g')-SNAPSHOT"

- name: Publish to MavenCentral
run: ./gradlew publishReleasePublicationToSonatypeRepository
Expand All @@ -52,4 +30,24 @@ jobs:
SIGNING_PASSWORD: ${{ secrets.GRADLE_SIGNING_PASSPHRASE }}
SIGNING_KEY: ${{ secrets.GRADLE_SIGNING_PRIVATE_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
MODULE_VERSION: ${{ steps.set-snapshot-version.outputs.VERSION }}
SNAPSHOT: true

- name: Find old comment to update comment for
uses: peter-evans/find-comment@v2
id: find-previous-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build available to test

- name: Inform pull request on build of SDK available to test
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-previous-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Build available to test
Version: `${{ steps.set-snapshot-version.outputs.VERSION }}`
Repository: `https://s01.oss.sonatype.org/content/repositories/snapshots/`
edit-mode: replace
2 changes: 1 addition & 1 deletion sdk/src/main/java/io/customer/sdk/CustomerIOClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ internal class CustomerIOClient(

backgroundQueue.addTask(
QueueTaskType.TrackEvent,
TrackEventQueueTaskData(name, Event(name, eventType, attributes, dateUtil.nowUnixTimestamp)),
TrackEventQueueTaskData(identifier, Event(name, eventType, attributes, dateUtil.nowUnixTimestamp)),
blockingGroups = listOf(QueueTaskGroup.IdentifyProfile(identifier))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class CustomerIOClientTest : BaseTest() {

verify(backgroundQueueMock).addTask(
QueueTaskType.TrackEvent,
TrackEventQueueTaskData(givenTrackEventName, Event(givenTrackEventName, EventType.event, givenAttributes, dateUtilStub.givenDateMillis)),
TrackEventQueueTaskData(givenIdentifier, Event(givenTrackEventName, EventType.event, givenAttributes, dateUtilStub.givenDateMillis)),
blockingGroups = listOf(QueueTaskGroup.IdentifyProfile(givenIdentifier))
)
}
Expand Down

0 comments on commit 71634ed

Please sign in to comment.