Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automate more parts of the publishing process #268

Merged
merged 4 commits into from
Jan 9, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build

on: [push, pull_request]
on:
push:
branches:
- '**'
pull_request:

jobs:
build:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +28,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install JDK
uses: actions/setup-java@v3
Expand All @@ -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/<latest-version>/$(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/
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: Publish Release
on:
push:
tags:
- '*'
- '**'

jobs:
publish:

runs-on: macos-latest
if: github.repository == 'freeletics/mad'

steps:
- name: Checkout
Expand All @@ -23,6 +24,16 @@ jobs:
- name: Install Android SDK
run: ./.github/android-sdk.sh

- name: Get release notes
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$(awk '/^## ${{ github.ref_name }}/{flag=1;next}/^## /{flag=0}flag' CHANGELOG.md)" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awk 🤯

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it from stack overflow 😆

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
Expand All @@ -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 }}
18 changes: 12 additions & 6 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
64 changes: 34 additions & 30 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -75,17 +89,16 @@ to the annotation.

- Migrate to Gradle version catalog

Version 0.7.2 *(2022-08-12)*
----------------------------

## 0.7.2 *(2022-08-12)*

### Navigator

- Fragment: Fix that the start destination sometimes does not have any arguments
- 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

Expand All @@ -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.

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -168,8 +178,7 @@ object {
deprecated


Version 0.4.0 *(2022-06-13)*
----------------------------
## 0.4.0 *(2022-06-13)*

### Navigator

Expand All @@ -189,17 +198,15 @@ 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

- fix a crash when `@NavEntryComponent` is completely unused
- fix a crash when using Whetstone with Compose navigation


Version 0.3.0 *(2022-04-13)*
----------------------------
## 0.3.0 *(2022-04-13)*

### Navigator

Expand All @@ -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<State>` instead of `Flow<State>`


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
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<latest-version>'
// when using composables for navigation
implementation 'com.freeletics.mad:navigator-compose:0.9.1'
implementation 'com.freeletics.mad:navigator-compose:<latest-version>'
// 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:<latest-version>'
```


Expand All @@ -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:<latest-version>'

implementation 'com.freeletics.mad:whetstone-runtime:0.9.1'
implementation 'com.freeletics.mad:whetstone-runtime:<latest-version>'
// when using Compose UI
implementation 'com.freeletics.mad:whetstone-runtime-compose:0.9.1'
implementation 'com.freeletics.mad:whetstone-runtime-compose:<latest-version>'
// 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:<latest-version>'

// for the integration with Navigator
implementation 'com.freeletics.mad:whetstone-navigation:0.9.1'
implementation 'com.freeletics.mad:whetstone-navigation:<latest-version>'
// 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:<latest-version>'
// 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:<latest-version>'
```


Expand All @@ -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:<latest-version>'
```


Expand All @@ -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:<latest-version>'
```


Expand Down
11 changes: 3 additions & 8 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -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`
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down