Change release management

This commit is contained in:
Dimitry Ivanov 2020-07-16 11:58:41 +03:00
parent df23339dba
commit 7d76cb8eac
19 changed files with 62 additions and 93 deletions

View File

@ -7,9 +7,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
@ -17,4 +15,4 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build -Prelease

View File

@ -1,33 +0,0 @@
name: Snapshot
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build -Prelease
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: deploy snapshot
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: ./gradlew upA -Prelease -PCI

View File

@ -1,6 +1,6 @@
# Changelog
# $nap;
# $SNAPSHOT;
#### Added
* `core` - `MovementMethodPlugin.none()`, `MovementMethodPlugin.link()` factory methods

View File

@ -1,5 +1,14 @@
# Markwon sample app
Collection of sample snippets showing different aspects of `Markwon` library usage. Includes
source code of samples, latest stable/snapshot version of the library and search functionality.
Additionally can check for updates. Can be used to preview markdown documents from the `Github.com`.
<a href="../art/sample-screen-01.png"><img src="../art/sample-screen-01.png" width="30%" /></a>
<a href="../art/sample-screen-02.png"><img src="../art/sample-screen-02.png" width="30%" /></a>
<a href="../art/sample-screen-03.png"><img src="../art/sample-screen-03.png" width="30%" /></a>
<a href="../art/sample-screen-04.png"><img src="../art/sample-screen-04.png" width="30%" /></a>
## Distribution
Sample app is distributed via special parent-less branch [sample-store](https://github.com/noties/Markwon/tree/sample-store).
@ -10,8 +19,10 @@ Application is signed with `keystore.jks`, which fingerprints are:
* __SHA1__: `BA:70:A5:D2:40:65:F1:FA:88:90:59:BA:FC:B7:31:81:E6:37:D9:41`
* __SHA256__: `82:C9:61:C5:DF:35:B1:CB:29:D5:48:83:FB:EB:9F:3E:7D:52:67:63:4F:D2:CE:0A:2D:70:17:85:FF:48:67:51`
[Download latest APK](https://github.com/noties/Markwon/raw/sample-store/markwon-debug.apk)
## Deeplink
Sample app handles special `markwon` scheme:
@ -32,7 +43,7 @@ Please note that you might need to _url encode_ the `-d` argument
When adding/removing samples _most likely_ a clean build would be required.
First, for annotation processor to create `samples.json`. And secondly,
in order for Android Gradle plugin to bundle resources references via
in order for Android Gradle plugin to bundle resources referenced via
symbolic links (the `sample.json` itself and `io.noties.markwon.app.samples.*` directory)
```

View File

@ -6,7 +6,7 @@ import android.view.ViewGroup
import io.noties.adapt.Item
import io.noties.markwon.app.R
class CheckForUpdateItem(private val action: () -> Unit) : Item<CheckForUpdateItem.Holder>(42L) {
class CheckForUpdateItem(private val action: () -> Unit) : Item<CheckForUpdateItem.Holder>(43L) {
override fun createHolder(inflater: LayoutInflater, parent: ViewGroup): Holder {
return Holder(inflater.inflate(R.layout.adapt_check_for_update, parent, false))

BIN
art/sample-screen-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
art/sample-screen-02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
art/sample-screen-03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
art/sample-screen-04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -8,7 +8,7 @@ android.enableJetifier=true
android.enableBuildCache=true
android.buildCacheDir=build/pre-dex-cache
VERSION_NAME=4.4.1-SNAPSHOT
VERSION_NAME=4.5.0-SNAPSHOT
GROUP=io.noties.markwon
POM_DESCRIPTION=Markwon markdown for Android

View File

@ -49,7 +49,7 @@ public abstract class MarkwonReducer {
Node temp;
while (node != null) {
// @since $nap; do not include LinkReferenceDefinition node (would result
// @since $SNAPSHOT; do not include LinkReferenceDefinition node (would result
// in empty textView if rendered in recycler-view)
if (!(node instanceof LinkReferenceDefinition)) {
list.add(node);

View File

@ -115,14 +115,14 @@ public class CorePlugin extends AbstractMarkwonPlugin {
// @since 4.0.0
private final List<OnTextAddedListener> onTextAddedListeners = new ArrayList<>(0);
// @since $nap;
// @since $SNAPSHOT;
private boolean hasExplicitMovementMethod;
protected CorePlugin() {
}
/**
* @since $nap;
* @since $SNAPSHOT;
*/
@SuppressWarnings("UnusedReturnValue")
@NonNull
@ -201,7 +201,7 @@ public class CorePlugin extends AbstractMarkwonPlugin {
// let's ensure that there is a movement method applied
// we do it `afterSetText` so any user-defined movement method won't be
// replaced (it should be done in `beforeSetText` or manually on a TextView)
// @since $nap; we additionally check if we should apply _implicit_ movement method
// @since $SNAPSHOT; we additionally check if we should apply _implicit_ movement method
if (!hasExplicitMovementMethod && textView.getMovementMethod() == null) {
textView.setMovementMethod(LinkMovementMethod.getInstance());
}

View File

@ -18,7 +18,7 @@ public class AsyncDrawable extends Drawable {
private final ImageSize imageSize;
private final ImageSizeResolver imageSizeResolver;
// @since $nap;
// @since $SNAPSHOT;
private final Drawable placeholder;
private Drawable result;
@ -30,7 +30,7 @@ public class AsyncDrawable extends Drawable {
// @since 2.0.1 for use-cases when image is loaded faster than span is drawn and knows canvas width
private boolean waitingForDimensions;
// @since $nap; in case if result is Animatable and this drawable was detached, we
// @since $SNAPSHOT; in case if result is Animatable and this drawable was detached, we
// keep the state to resume when we are going to be attached again (when used in RecyclerView)
private boolean wasPlayingBefore = false;
@ -136,13 +136,13 @@ public class AsyncDrawable extends Drawable {
result.setCallback(callback);
}
// @since $nap; we trigger loading only if we have no result (and result is not placeholder)
// @since $SNAPSHOT; we trigger loading only if we have no result (and result is not placeholder)
final boolean shouldLoad = result == null || result == placeholder;
if (result != null) {
result.setCallback(callback);
// @since $nap;
// @since $SNAPSHOT;
if (result instanceof Animatable && wasPlayingBefore) {
((Animatable) result).start();
}
@ -229,7 +229,7 @@ public class AsyncDrawable extends Drawable {
public void setResult(@NonNull Drawable result) {
// @since $nap; revert this flag when we have new source
// @since $SNAPSHOT; revert this flag when we have new source
wasPlayingBefore = false;
// if we have previous one, detach it

View File

@ -22,7 +22,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin {
*
* @see #create(MovementMethod)
* @see #link()
* @deprecated $nap; use {@link #link()}
* @deprecated $SNAPSHOT; use {@link #link()}
*/
@NonNull
@Deprecated
@ -31,7 +31,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin {
}
/**
* @since $nap;
* @since $SNAPSHOT;
*/
@NonNull
public static MovementMethodPlugin link() {
@ -42,7 +42,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin {
* Special {@link MovementMethodPlugin} that is <strong>not</strong> applying a MovementMethod on a TextView
* implicitly
*
* @since $nap;
* @since $SNAPSHOT;
*/
@NonNull
public static MovementMethodPlugin none() {
@ -58,7 +58,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin {
private final MovementMethod movementMethod;
/**
* Since $nap; change to be <em>nullable</em>
* Since $SNAPSHOT; change to be <em>nullable</em>
*/
@SuppressWarnings("WeakerAccess")
MovementMethodPlugin(@Nullable MovementMethod movementMethod) {
@ -73,7 +73,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin {
@Override
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
// @since $nap; check for equality
// @since $SNAPSHOT; check for equality
final MovementMethod current = textView.getMovementMethod();
if (current != movementMethod) {
textView.setMovementMethod(movementMethod);

View File

@ -83,7 +83,7 @@ public abstract class JLatexMathTheme {
}
/**
* @since $nap;
* @since $SNAPSHOT;
*/
@NonNull
public static Padding of(int left, int top, int right, int bottom) {

View File

@ -28,7 +28,7 @@ public abstract class SimpleTagHandler extends TagHandler {
@Override
public void handle(@NonNull MarkwonVisitor visitor, @NonNull MarkwonHtmlRenderer renderer, @NonNull HtmlTag tag) {
// @since $nap; check if tag is block one and visit children
// @since $SNAPSHOT; check if tag is block one and visit children
if (tag.isBlock()) {
visitChildren(visitor, renderer, tag.getAsBlock());
}

View File

@ -44,7 +44,7 @@ public class GlideImagesPlugin extends AbstractMarkwonPlugin {
@NonNull
public static GlideImagesPlugin create(@NonNull final Context context) {
// @since $nap; cache RequestManager
// @since $SNAPSHOT; cache RequestManager
// sometimes `cancel` would be called after activity is destroyed,
// so `Glide.with(context)` will throw an exception
return create(Glide.with(context));

View File

@ -29,7 +29,7 @@ public class BangInlineProcessor extends InlineProcessor {
return node;
} else {
// @since $nap; return null in case no match (multiple inline
// @since $SNAPSHOT; return null in case no match (multiple inline
// processors can define `!` as _special_ character, so let them handle it)
// NB! do not forget to reset index
index = startIndex;

View File

@ -1,49 +1,42 @@
# Release management
There are 2 core branches:
* `master`
* `develop`
Development happens in the `master` branch. Although CI (via Github workflows) is triggered
with each push, all releases are happening in manual mode (stable and snapshot versions
of the library and the sample app).
`master` represents currently released version. In most cases its `HEAD` must also
point to a tag with release version name.
```
# Stable and snapshot library release (depending on the version specified in `gradle.properties`)
./gradlew upA -Prelease
`develop` represents version that is currently in development. It always should have
`-SNAPSHOT` suffix in `VERSION_NAME` variable (defined in `gradle.properties`).
Ideally each push to `develop` should also publish a SNAPSHOT version to MavenCentral (pending resolution).
# Sample app release
./app-sample/deploy.sh
```
Before releasing a new version a new branch is created. It's name should follow
the `v4.1.1` pattern (where `4.1.1` is upcoming release version name). In this branch
should all release preparations be done (removing all mentions of SNAPSHOT and updating
version name). Then a pull-request is issued from this branch to `master`.
After a pull-request is resolved (merged to `master`) all changes must be reflected in `develop`
branch (merge with `master`), next `VERSION_NAME` must be assigned with `-SNAPSHOT` suffix and published to snapshot Maven repo
(snapshot users will see an update available).
The issuer branch (with version name) should be deleted.
A new version must be pushed to MavenCentral and new git-tag with version name must be
created in the repository.
Rinse and repeat.
Tests must be run before releasing (either locally or via CI).
## `@since` annotation
Although it is not required it is a nice thing to do: add `@since $VERSION` comment to the code
whenever it is possible (at least for publicly accessible code - API). This would help
navigating the project without the need to checkout the full VCS history. As keeping track of
current and/or upcoming version can be error-prone it is better to insert a generic `@since code`
that can be properly substituted upon a release.
All code changes should have a documentation comment with version of the library specified.
For changes before _stable_ release (snapshots) a special `$SNAPSHOT;` version can be used
(useful when the next version name of the library is still not known).
For example, `@since $nap` seems like a good candidate. For this a live template can be created and used
whenever a new API method/field/functionality-change is introduced (`snc`):
```java
/**
* @since $SNAPSHOT;
*/
```
// semicolon with a space so this one is not accedentally replaced with release version
@since $nap ;
// @since $SNAPSHOT;
```
This live template would be possible to use in both inline comment and javadoc comment.
These changes must also be placed in according section of the `CHANGELOG.md` file:
* `Added`
* `Changed`
* `Fixed`
* `Deprecated`
* `Removed`
## documentation
Stable release must replace all `$SNAPSHOT;` occurrences with proper library version name.
If there are updates to documentation web site, do not forget to publish it
## Documentation
If there are updates to documentation web site these should be published