diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af08cd185..74d67008d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Build -on: [push, pull_request] +on: + push: + branches: + - '**' + pull_request: jobs: build: diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 83376fff3..ae6fc6c45 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -4,11 +4,17 @@ on: push: branches: - main + # TODO: replace with on push tag https://github.com/actions/deploy-pages/issues/76 + workflow_run: + workflows: [Publish Release] + types: + - completed jobs: publish: runs-on: ubuntu-latest + if: github.repository == 'freeletics/mad' permissions: contents: read @@ -22,6 +28,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Install JDK uses: actions/setup-java@v3 @@ -46,6 +54,8 @@ jobs: - name: Copy docs run: | cp README.md docs/index.md + sed -i '/^\[\!\[GitHub release/d' docs/index.md + sed -i "s//$(git describe --tags --abbrev=0)/" docs/index.md cp navigator/README.md docs/navigator.md mkdir -p docs/API/navigator cp -R navigator/runtime/build/dokka/html/. docs/API/navigator/ diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 9acb2c424..4cce8eb2c 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -3,12 +3,13 @@ name: Publish Release on: push: tags: - - '*' + - '**' jobs: publish: runs-on: macos-latest + if: github.repository == 'freeletics/mad' steps: - name: Checkout @@ -23,6 +24,16 @@ jobs: - name: Install Android SDK run: ./.github/android-sdk.sh + - name: Get release notes + run: | + echo "RELEASE_NOTES<> $GITHUB_ENV + echo "$(awk '/^## ${{ github.ref_name }}/{flag=1;next}/^## /{flag=0}flag' CHANGELOG.md)" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Set version for tag + run: | + echo "ORG_GRADLE_PROJECT_VERSION_NAME=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: gradle/gradle-build-action@v2 - name: Publish @@ -32,3 +43,9 @@ jobs: ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_PRIVATE_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }} + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: ${{ env.RELEASE_NOTES }} diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index bd305ab5c..26b2d98f1 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -4,14 +4,20 @@ on: push: branches: - '**' + tags: + - '**' jobs: publish: + runs-on: macos-latest + if: github.repository == 'freeletics/mad' steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Install JDK uses: actions/setup-java@v3 @@ -22,15 +28,15 @@ jobs: - name: Install Android SDK run: ./.github/android-sdk.sh - - name: Set version for branch - if: ${{ github.event_name != 'pull_request' && github.ref_name != 'main' }} + - name: Set version for main + if: ${{ github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/') }} run: | - echo "ORG_GRADLE_PROJECT_VERSION_NAME=${{ github.ref_name }}-SNAPSHOT" | sed 's#/#-#g' >> $GITHUB_ENV + echo "ORG_GRADLE_PROJECT_VERSION_NAME=$(git describe --tags --abbrev=0 | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)-SNAPSHOT" >> $GITHUB_ENV - - name: Set version for pull request - if: github.event_name == 'pull_request' + - name: Set version for branch + if: ${{ github.ref_name != 'main' && !startsWith(github.ref, 'refs/tags/') }} run: | - echo "ORG_GRADLE_PROJECT_VERSION_NAME=pr${{ github.event.number }}-SNAPSHOT" | sed 's#/#-#g' >> $GITHUB_ENV + echo "ORG_GRADLE_PROJECT_VERSION_NAME=${{ github.ref_name }}-SNAPSHOT" | sed 's#/#-#g' >> $GITHUB_ENV - uses: gradle/gradle-build-action@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index e808bd2e4..76821b80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,28 @@ Change Log ========== -Version 0.9.1 *(2022-11-23)* ----------------------------- +## 0.10.0 **UNRELEASED** + +### Navigator +- `navigateToRoot` now has a `saveCurrentRootState` parameter which defaults to true (matches the previous implicit behavior). Can be set to false to clear the current back stack. +- `navigateBackTo` now does not allow passing a `NavRoot` as target anymore. Use `navigateToRoot<...>(false, false)` instead +- `ActivityRoute` is now always `Parcelable` and has been split into 2 sub-classes/interfaces `InternalActivityRoute` for `Activity` classes inside the app and `ExternalActivityRoute` for Intents that leave the app +- `PermissionResult` is now a sealed class instead of an enum class. The `DENIED` and `DENIED_FOREVER` values were merged into a single `Denied` subclass that has a `showRationale` boolean property. This being `false` would match the old denied forever value. The reason for this change is that `Denied` with `showRationale` being `false` does not necessarily mean denied forever on newer platform versions, it could also mean that the first ever permission prompt was dismissed without making a choice. +- Make a few APIs that were not meant to be public internal or mark them as such +- Internal: share more code between the compose and fragment implementations +- Internal: unify handling of permission results and activity results + +### Whetstone +- Remove dependency on AndroidX navigation. Whetstone’s navigation artifacts now only rely on our own navigator APIs +- Internal: Stop generating view models for each annotated screen. Instead use a runtime class to hold on to components + +## 0.9.1 *(2022-11-23)* ### Whetstone - Fix action lambda in Compose code generation -Version 0.9.0 *(2022-11-22)* ----------------------------- + +## 0.9.0 *(2022-11-22)* ### Whetstone - Add support for injecting dependencies into Composable functions, which are annotated with @@ -17,8 +31,8 @@ Version 0.9.0 *(2022-11-22)* ### Navigator - Refactor runtime module to remove androidx navigation -Version 0.8.1 *(2022-11-08)* ----------------------------- + +## 0.8.1 *(2022-11-08)* ### Whetstone - Update codegen to use new `Bundle.requireRoute` function @@ -27,8 +41,8 @@ Version 0.8.1 *(2022-11-08)* - New module for shared androidx navigation - Deploy docs directly from Github Actions -Version 0.8.0 *(2022-11-08)* ----------------------------- + +## 0.8.0 *(2022-11-08)* ### Navigator @@ -75,8 +89,8 @@ to the annotation. - Migrate to Gradle version catalog -Version 0.7.2 *(2022-08-12)* ----------------------------- + +## 0.7.2 *(2022-08-12)* ### Navigator @@ -84,8 +98,7 @@ Version 0.7.2 *(2022-08-12)* - Fix an issue that caused navigation results to be delivered multiple times -Version 0.7.1 *(2022-07-12)* ----------------------------- +## 0.7.1 *(2022-07-12)* - Sources are now visible in Android Studio again @@ -94,8 +107,7 @@ Version 0.7.1 *(2022-07-12)* - Fix a crash in the navigation result APIs -Version 0.7.0 *(2022-07-04)* ----------------------------- +## 0.7.0 *(2022-07-04)* Updated to Kotlin 1.7.0 and Compose compiler 1.2.0. @@ -118,8 +130,7 @@ Updated to Kotlin 1.7.0 and Compose compiler 1.2.0. - removed dependency on `LiveData` -Version 0.6.0 *(2022-06-28)* ----------------------------- +## 0.6.0 *(2022-06-28)* ### Whetstone @@ -129,8 +140,7 @@ Version 0.6.0 *(2022-06-28)* qualifier -Version 0.5.0 *(2022-06-21)* ----------------------------- +## 0.5.0 *(2022-06-21)* ### Navigator @@ -168,8 +178,7 @@ object { deprecated -Version 0.4.0 *(2022-06-13)* ----------------------------- +## 0.4.0 *(2022-06-13)* ### Navigator @@ -189,8 +198,7 @@ Version 0.4.0 *(2022-06-13)* - Fix code generation in Kotlin 1.6.20 -Version 0.3.1 *(2022-04-20)* ----------------------------- +## 0.3.1 *(2022-04-20)* ### Whetstone @@ -198,8 +206,7 @@ Version 0.3.1 *(2022-04-20)* - fix a crash when using Whetstone with Compose navigation -Version 0.3.0 *(2022-04-13)* ----------------------------- +## 0.3.0 *(2022-04-13)* ### Navigator @@ -223,20 +230,17 @@ functionality might change significantly and that the documentation is missing ( comments on the code). It is already being used in production at Freeletics. -Version 0.2.0 *(2021-06-18)* ----------------------------- +## 0.2.0 *(2021-06-18)* - update `StateMachine.state` to return `StateFlow` instead of `Flow` -Version 0.1.1 *(2021-06-16)* ----------------------------- +## 0.1.1 *(2021-06-16)* - fix windows artifact of `state-machine` not being published -Version 0.1.0 *(2021-06-16)* ----------------------------- +## 0.1.0 *(2021-06-16)* - initial release of the `state-machine` artifact - initial release of the `text-resource` artifact diff --git a/README.md b/README.md index 520011188..1c20bf809 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,14 @@ modularized code base. For more information check out its [README][4]. +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/freeletics/mad?logo=github&sort=semver)](https://github.com/freeletics/mad/releases) + ```groovy -implementation 'com.freeletics.mad:navigator:0.9.1' +implementation 'com.freeletics.mad:navigator:' // when using composables for navigation -implementation 'com.freeletics.mad:navigator-compose:0.9.1' +implementation 'com.freeletics.mad:navigator-compose:' // when using fragments for navigation (even if these contain composables) -implementation 'com.freeletics.mad:navigator-fragment:0.9.1' +implementation 'com.freeletics.mad:navigator-fragment:' ``` @@ -32,21 +34,23 @@ generating dependency injection related code and common boilerplate for feature For more information check out its [README][6]. +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/freeletics/mad?logo=github&sort=semver)](https://github.com/freeletics/mad/releases) + ```groovy -anvil 'com.freeletics.mad:whetstone-compiler:0.9.1' +anvil 'com.freeletics.mad:whetstone-compiler:' -implementation 'com.freeletics.mad:whetstone-runtime:0.9.1' +implementation 'com.freeletics.mad:whetstone-runtime:' // when using Compose UI -implementation 'com.freeletics.mad:whetstone-runtime-compose:0.9.1' +implementation 'com.freeletics.mad:whetstone-runtime-compose:' // when using fragments (even if these contain Compose UI) -implementation 'com.freeletics.mad:whetstone-runtime-fragment:0.9.1' +implementation 'com.freeletics.mad:whetstone-runtime-fragment:' // for the integration with Navigator -implementation 'com.freeletics.mad:whetstone-navigation:0.9.1' +implementation 'com.freeletics.mad:whetstone-navigation:' // for the integration with Navigator - when using Compose UI -implementation 'com.freeletics.mad:whetstone-navigation-compose:0.9.1' +implementation 'com.freeletics.mad:whetstone-navigation-compose:' // for the integration with Navigator - when using fragments (even if these contain Compose UI) -implementation 'com.freeletics.mad:whetstone-navigation-fragment:0.9.1' +implementation 'com.freeletics.mad:whetstone-navigation-fragment:' ``` @@ -60,8 +64,10 @@ For an example on how to build such a state machine check out [FlowRedux][2]. To When using Compose UI the `StateMachine` can be observed with `produceState()` and actions can be dispatched to it by simply launching them from a `CoroutineScope` created with `rememberCoroutineScope()`. +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/freeletics/mad?logo=github&sort=semver)](https://github.com/freeletics/mad/releases) + ```groovy -implementation 'com.freeletics.mad:state-machine:0.9.1' +implementation 'com.freeletics.mad:state-machine:' ``` @@ -76,8 +82,10 @@ This way business logic with text can be easily tested without requiring For more information about the motivation for this abstraction check out this [blog post][1]. +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/freeletics/mad?logo=github&sort=semver)](https://github.com/freeletics/mad/releases) + ```groovy -implementation 'com.freeletics.mad:text-resource:0.9.1' +implementation 'com.freeletics.mad:text-resource:' ``` diff --git a/RELEASING.md b/RELEASING.md index d262a66b6..ff9051bc7 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,11 +1,6 @@ Releasing ======== - 1. Change the version in `gradle.properties` to a non-SNAPSHOT version. - 2. Update the `CHANGELOG.md` for the impending release. - 3. Update the `README.md` with the new version. - 4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version) - 5. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version) - 6. Update the `gradle.properties` to the next SNAPSHOT version. - 7. `git commit -am "Prepare next development version."` - 8. `git push && git push --tags` +1. Make sure `CHANGELOG.md` is up-to-date on `main` for the impeding release. +2. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version) +3. `git push --tags` diff --git a/gradle.properties b/gradle.properties index 9320ecfcb..87a1827f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,7 @@ org.gradle.jvmargs=-Xmx1536m org.gradle.parallel=true android.useAndroidX=true +android.disableAutomaticComponentCreation=true kotlin.mpp.stability.nowarn=true kotlin.native.ignoreDisabledTargets=true kapt.include.compile.classpath=false @@ -12,7 +13,6 @@ dependency.analysis.warnings.silent=true SONATYPE_HOST=DEFAULT SONATYPE_AUTOMATIC_RELEASE=true RELEASE_SIGNING_ENABLED=true -android.disableAutomaticComponentCreation=true GROUP=com.freeletics.mad VERSION_NAME=0.10.0-SNAPSHOT