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

Introduce Automatic release #223

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ captures/
*.iml
.idea/*
!.idea/codeStyleSettings.xml
.idea/
Copy link
Contributor

@jmatsu jmatsu Feb 9, 2017

Choose a reason for hiding this comment

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

JFYI, you can use git update-index --skip-worktree .idea/$FILENAME to ignore git-controlled files with keeping changes. 😃

Copy link
Author

Choose a reason for hiding this comment

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

@jmatsu THX! I did't know about that...👽


# Keystore files
*.jks

.DS_Store
.DS_Store
/key.json
/deploy2store.sh
/serviceaccount.json
1 change: 0 additions & 1 deletion .idea/icon.png

This file was deleted.

73 changes: 73 additions & 0 deletions README_AUTOMATED_RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Automated release

Make releasing easy!

If you have any question, feel free to ask to me (@wakwa3125).

# ATTENTION

**FIRST YOU MUST UPLOAD YOUR APK FILE WITH NON-AUTOMATED FLOW**
**THIS IS PUBLISHING API RESTRICT**

# Setup

## 1. Install supply(fastlane)

```
gem install fastlane
```

## 2. Create Service Account at GooglePlayConsole.
Copy link
Contributor

Choose a reason for hiding this comment

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

🙋
Is this section almost same with fastlane setup README? If so, I think it's enough to write the link url here.
What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Yes right.
But there are many noise to read core sentences.
So I try to rewrite about setup sentences.
But now I think I should add original link of fastlane,'s one.

Copy link
Contributor

Choose a reason for hiding this comment

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

But there are many noise to read core sentences.

Make sense.
I'm just afraid that it might be hard to follow latest setup info. But it's okay as it is! Thanks!


1. Go to your Google Play Developer Console.
2. Select Settings tab.
3. Select API access tab.
4. Click Create ServiceAccount and follow the dialog.
5. Provide name for the ServiceAccount.
6. Click Select a role and choose Project > **Service Account Actor**
7. **Furnish a new private key checkbox**(It's important!)
8. Select JSON as the key type.
9. Click create.
10. Download the JSON key file as file name **key.json**
11. Back to Google Play Developer Console, and click Done button.
12. Provide access to the new ServiceAccount.
13. Set Release Manager as role of new ServiceAccount.
14. Click add user to close the dialog.

## 3. Prepare for this project.

1. First run `./gradlew setUpRelease`
This just create required files.

2. Put your key.json file to project root.
This file has add to .gitignore. So it's safe.

3. Open `deploy2store.sh` and replace `[YOUR_APK_FILE_NAME]` to yours.

4. Second run `./gradlew donwloadMetaData`
This download all metadata(such as changelogs) from GooglePlayStore and save them to repo.

# Release
## Write changelogs
- **You can skip this. Because you can wirte changelog at your console.**
**File name roule is [versioncode].txt**
Save your changelogs like a following directory.
This directory is made by run `./gradlew downloadMetaData`

```
└── fastlane
└── metadata
└── android
├── en-US
│ └── changelogs
│ ├── 100000.txt
│ └── 100100.txt
└── fr-FR
└── changelogs
└── 100100.txt
...
```

## Run the script
- Just run `./gradlew releaseApp`
APK will upload to alpha channel.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ apply plugin: 'jacoco'
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.firebase.firebase-crash'
Copy link
Contributor

Choose a reason for hiding this comment

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

Question 🙋
Why is this necessary?

Copy link
Author

Choose a reason for hiding this comment

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

It can upload the mapping file to FirebaseCrash.
But, I fogot to introduce this to deploy process.
I'll fix it tomorrow.

apply plugin: 'com.cookpad.android.licensetools'
apply plugin: 'com.github.ben-manes.versions'
apply from: '../gradle/task.gradle'

// Manifest version
def versionMajor = 0
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.6"
classpath 'com.google.firebase:firebase-plugins:1.0.5'
classpath 'com.cookpad.android.licensetools:license-tools-plugin:0.19.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0'
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true

# Firebase Crash Plugin
FirebaseServiceAccountFilePath=serviceaccount.json
30 changes: 30 additions & 0 deletions gradle/task.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copy template shell
* */
task setUpRelease(type: Exec) {
workingDir '../'
commandLine "./gradlew", "clean"
commandLine "./script/bootstrap.sh"
}

/**
*
* Init this project with supply
* */
task downloadMetaData(type: Exec) {
workingDir '../'
commandLine "./gradlew", "clean"
commandLine "./script/initsupply.sh"
}

/**
*
* Release your AWESOME app to GooglePlay(alpha channel)
* */
// TODO: Build apk with FirebaseCrash plugin
task releaseApp(type: Exec) {
workingDir '../'
commandLine "./gradlew", "clean"
commandLine "./gradlew", "app:firebaseUploadProductionReleaseProguardMapping"
commandLine "./script/deploy2store.sh"
}
1 change: 1 addition & 0 deletions script/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cp ./script/deploy2store.template ./script/deploy2store.sh
6 changes: 6 additions & 0 deletions script/deploy2store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
fastlane supply run -p io.github.droidkaigi.confsched2017 \
-a alpha \
-j ./key.json \
-u /app/build/outputs/apk/[YOUR_APK_FILE_NAME] \
--verbose --skip_upload_images --skip_upload_screenshots
6 changes: 6 additions & 0 deletions script/deploy2store.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
fastlane supply run -p io.github.droidkaigi.confsched2017 \
-a alpha \
-j ./key.json \
-u /app/build/outputs/apk/[YOUR_APK_FILE_NAME] \
--verbose --skip_upload_images --skip_upload_screenshots
3 changes: 3 additions & 0 deletions script/initsupply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastlane supply init \
-j ./key.json \
-p o.github.droidkaigi.confsched2017