From 07932d9094a1f367485648a5831228ba8826ffb9 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 26 Sep 2023 16:08:40 +0200 Subject: [PATCH] fix --- .github/workflows/format-code.yml | 63 ------------------------------- MIGRATION.md | 33 ++++++++++++++++ scripts/commit-code.sh | 4 +- 3 files changed, 34 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/format-code.yml diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml deleted file mode 100644 index 841294c6..00000000 --- a/.github/workflows/format-code.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: 'Format code & Generate API' -on: - push: - pull_request: - -jobs: - cancel-previous-workflow: - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # pin@0.11.0 - with: - access_token: ${{ github.token }} - - format: - name: Build Job ${{ matrix.os }} - Java ${{ matrix.java }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - java: ['17'] - - steps: - - name: Git checkout - uses: actions/checkout@v4 - - - name: 'Set up Java: ${{ matrix.java }}' - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Generate API diff - run: make api - - - name: Format - run: make format - - # Source: https://stackoverflow.com/a/58035262 - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - id: extract_branch - - # actions/checkout fetches only a single commit in a detached HEAD state. Therefore - # we need to pass the current branch, otherwise we can't commit the changes. - # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. - - name: Commit Formatted Code and API - run: ./scripts/commit-code.sh ${{ steps.extract_branch.outputs.branch }} - - - name: Make stop - run: make stop diff --git a/MIGRATION.md b/MIGRATION.md index e1dbfaf8..33e62af8 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,3 +1,36 @@ Migration from v2 to v3 ============ +## Setup v2 + +```kotlin +import com.posthog.PostHog + +val apiKey = "..." +val posthog = PostHog.Builder(applicationContext, apiKey) + .captureApplicationLifecycleEvents() + captureDeepLinks() + .recordScreenViews() + .build() +PostHog.setSingletonInstance(posthog) + +PostHog.with(applicationContext).capture("event") +``` + +## Setup v3 + +```kotlin +import com.posthog.PostHog +import com.posthog.android.PostHogAndroid +import com.posthog.android.PostHogAndroidConfig + +val apiKey = "..." +val config = PostHogAndroidConfig(apiKey).apply { + captureApplicationLifecycleEvents = true + captureDeepLinks = true + captureScreenViews = true +} +PostHogAndroid.setup(applicationContext, config) + +PostHog.capture("event") +``` diff --git a/scripts/commit-code.sh b/scripts/commit-code.sh index 53576e2f..28b071dd 100755 --- a/scripts/commit-code.sh +++ b/scripts/commit-code.sh @@ -12,10 +12,8 @@ else echo "Going to push the changes." git config --global user.name 'PostHog Github Bot' git config --global user.email 'github-bot@posthog.com' - git config pull.ff only git fetch git checkout ${GITHUB_BRANCH} - git commit -am "Push changes" - git merge --no-ff ${GITHUB_BRANCH} + git commit -am "Update version" git push --set-upstream origin ${GITHUB_BRANCH} fi