From ae0dbc711b6f60a8aa1c0c845f1a7bce0705ecdb Mon Sep 17 00:00:00 2001 From: Abhijit Kiran Valluri Date: Sun, 27 Sep 2020 19:31:07 +0100 Subject: [PATCH] [skip ci] enable release automation + fix PR template + update readme (#168) Enabling release automation!! We can now create releases automatically by simply pushing a tag to the repo. Instructions in the README. Updated README to have some emojis that will make some important instructions pop out! Plus minor fix to the PR template file that creates the boilerplate below. --- .github/PULL_REQUEST_TEMPLATE | 3 +- .github/workflows/release-automation.yml | 94 ++++++++++++++++++++++++ README.md | 12 ++- 3 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release-automation.yml diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE index ead5583ea..ff9998bb7 100644 --- a/.github/PULL_REQUEST_TEMPLATE +++ b/.github/PULL_REQUEST_TEMPLATE @@ -7,8 +7,7 @@ - [ ] **Accessibility**: The code in this PR follows [accessibility best practices](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) or does not include any user facing features. In addition, it includes a screenshot of a successful [accessibility scan](https://play.google.com/store/apps/details?id=com.google.android.apps.accessibility.auditor&hl=en_US) to ensure no new defects are added to the product. ### To download an APK when reviewing a PR: -The PR runs an Android build check (`run-build`) that builds a `forkRelease` variant of the app. If it succeeds, then we upload the apks (signed with debug keys) via Github actions. -We also generate a comment with some instructions and a link to help you find the downloads. You can also follow the instructions below: +The PR runs an Android build check (`run-build`) that builds a `forkRelease` variant of the app. If it succeeds, then we upload the apks (signed with debug keys) via Github actions. We also generate a comment with some instructions and a link to help you find the downloads. You can also follow the instructions below: 1. Click Details next to "run-build (pull_request_target)" after it finishes with a green checkmark. 2. Click the "Artifacts" drop-down near the top right of the page. 3. The apk links should be present in the drop-down menu. You can click on the suitable CPU architecture to download a zipped apk file. diff --git a/.github/workflows/release-automation.yml b/.github/workflows/release-automation.yml new file mode 100644 index 000000000..75b9aa92f --- /dev/null +++ b/.github/workflows/release-automation.yml @@ -0,0 +1,94 @@ +name: Release Automation +on: + create: +jobs: + release-automation: + name: Create Release + runs-on: ubuntu-latest + if: "contains(toJSON(github.event.ref_type), 'tag') && contains(toJSON(github.event.ref), 'iceraven')" + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Create local.properties (to sign release apk with debug keys) + run: echo "autosignReleaseWithDebugKey=" >local.properties + - name: Build forkRelease variant of app + uses: eskatos/gradle-command-action@v1 + with: + wrapper-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true + arguments: assembleForkRelease -PversionName="$(git describe --tags HEAD)" + - name: Create changelog + run: | + PREVIOUS_RELEASE_TAG=$(git tag --list iceraven-* --sort=-creatordate | tail -n+2 | head -n 1) + + echo "## Automated release of version ${{ github.event.ref }} browser" >>temp_changelog.md + echo " " >>temp_changelog.md + echo "This is an automated release, consisting of the following changes:" >>temp_changelog.md + echo "### Change log (commit history since previous release)" >>temp_changelog.md + echo " " >>temp_changelog.md + git log ${{ github.event.ref }}...$PREVIOUS_RELEASE_TAG --pretty='format:%C(auto)%h (%as) %s' >>temp_changelog.md + echo " " >>temp_changelog.md + echo "**NOTE**: @maintainers, you can edit these auto-generated release notes with a more user-friendly summary of the key changes, if needed." >>temp_changelog.md + echo " " >>temp_changelog.md + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.ref }} + release_name: "Version ${{ github.event.ref }}" + draft: false + prerelease: false + body_path: temp_changelog.md + + - name: Upload arm64 apk + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/forkRelease/app-arm64-v8a-forkRelease.apk + asset_name: iceraven-browser-arm64-v8a-forkRelease.apk + asset_content_type: application/vnd.android.package-archive + + + - name: Upload armeabi apk + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/forkRelease/app-armeabi-v7a-forkRelease.apk + asset_name: iceraven-browser-armeabi-v7a-forkRelease.apk + asset_content_type: application/vnd.android.package-archive + + + - name: Upload x86 apk + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/forkRelease/app-x86-forkRelease.apk + asset_name: iceraven-browser-x86-forkRelease.apk + asset_content_type: application/vnd.android.package-archive + + + - name: Upload x86_64 apk + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/forkRelease/app-x86_64-forkRelease.apk + asset_name: iceraven-browser-x86_64-forkRelease.apk + asset_content_type: application/vnd.android.package-archive diff --git a/README.md b/README.md index 2faab0e95..e23e73f77 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ That said, Iceraven Browser is an independent all-volunteer project, and has no [**Download APKs from the Releases Page**](https://github.com/fork-maintainers/iceraven-browser/releases) -## Building +## 🔨 Building 1. Set up the environment. We need the Android SDK at `$ANDROID_SDK_ROOT` and a Java JDK at `$JAVA_HOME` that isn't the Ubuntu Java 8 one. We want environment variables that look something like: @@ -86,14 +86,20 @@ Developers are especially welcome, wanted, and needed. We encourage you to participate in this open source project. We love Pull Requests, Bug Reports, ideas, (security) code reviews or any other kind of positive contribution. -### How to skip CI checks for PRs +### 🙅 How to skip CI checks for PRs 🙅 If you want to skip Github CI checks in a PR, please add the following to the PR title exactly: `[skip ci]`. Also, please include the exact phrase `[skip ci]` in every commit message. This is to avoid Travis CI checks as well as skipping Github CI checks after merging the commits to the `fork` branch. This is useful to do **if** you are sure that your changes do not effect the app's code (ex: changes to `README.md`). -## I want to file an issue! +## 🚀 Release automation 🚀 + +We have now setup release automation so that Github actions automatically trigger a release build and publish a release when we push a tag to the repository. + +**NOTE**: The tag should be of the format `iceraven-x.y.z`, where `x.y.z` is the release version, for the automation to kick in and also so that the built app will have the correct version name. + +## ✏️ I want to file an issue! Great! We encourage you to participate in this open source project. We love Pull Requests, Bug Reports, ideas, (security) code reviews or any other kind of positive contribution.