-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add staging buildtype in gradle * add staging yml * updated yml * added staging in other CI actions * changed to staging-CI branch * test remove exact match * fix * fixup! added staging in other CI actions * run staging on tag updates also * fixup! added staging in other CI actions * change tag versioning * convert to staging * add exact-match * fix * update production release * additional checks * remove branch dependency * add match and exclude filter for tags
- Loading branch information
1 parent
584ef1a
commit fd274ce
Showing
4 changed files
with
162 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: Staging Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-beta[0-9]' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]' | ||
|
||
jobs: | ||
check-staging: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Check staging branch | ||
id: check | ||
run: | | ||
SHA=$(git log -n1 --format=format:"%H") | ||
git checkout staging | ||
git merge-base --is-ancestor $SHA HEAD | ||
get-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: staging | ||
- name: Get tagname of push | ||
id: check | ||
run: | | ||
git describe --exact-match --exclude "v*-prod" HEAD | ||
echo "The tag is " $(git describe --exact-match --exclude "v*-prod" HEAD) | ||
echo ::set-output name=tagname::$(git describe --exact-match --exclude "v*-prod" HEAD) | ||
outputs: | ||
tagname: ${{ steps.check.outputs.tagname }} | ||
|
||
staging: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- check-staging | ||
- get-tag | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: staging | ||
|
||
- name: set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: Setup Environment | ||
env: | ||
RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} | ||
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }} | ||
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | ||
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | ||
RELEASE_API_URL: ${{ secrets.RELEASE_API_URL }} | ||
STAGING_API_URL: ${{ secrets.STAGING_API_URL }} | ||
DEBUG_API_URL: ${{ secrets.DEBUG_API_URL }} | ||
RELEASE_SIGN_FILE: ${{ secrets.RELEASE_SIGN_FILE }} | ||
run: | | ||
echo -e "android.enableJetifier=true\nandroid.useAndroidX=true\nandroid.enableBuildCache=true\nkotlin.code.style=official\nkotlin.incremental=true\norg.gradle.configureondemand=true\norg.gradle.daemon=true\norg.gradle.parallel=true\norg.gradle.caching=true" > gradle.properties | ||
echo "RELEASE_STORE_FILE=../sign.jks" >> gradle.properties | ||
echo "RELEASE_STORE_PASSWORD=$RELEASE_STORE_PASSWORD" >> gradle.properties | ||
echo "RELEASE_KEY_ALIAS=$RELEASE_KEY_ALIAS" >> gradle.properties | ||
echo "RELEASE_KEY_PASSWORD=$RELEASE_KEY_PASSWORD" >> gradle.properties | ||
echo "RELEASE_API_URL=$RELEASE_API_URL" >> gradle.properties | ||
echo "DEBUG_API_URL=$DEBUG_API_URL" >> gradle.properties | ||
echo "STAGING_API_URL=$STAGING_API_URL" >> gradle.properties | ||
echo "$RELEASE_SIGN_FILE" | base64 -d > sign.jks | ||
- name: Staging APK Build | ||
run: ./gradlew assembleStaging | ||
|
||
- name: Staging Bundle Build | ||
run: ./gradlew bundleStaging | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${{ needs.get-tag.outputs.tagname }} | ||
|
||
- name: Setup Create Release | ||
id: release-drafter | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ steps.get_version.outputs.VERSION }} | ||
release_name: Release ${{ steps.get_version.outputs.VERSION }} | ||
body: | | ||
Pre-release: ${{ steps.get_version.outputs.VERSION }} | ||
draft: true | ||
prerelease: true | ||
|
||
- name: Upload APK | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.release-drafter.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./app/build/outputs/apk/staging/app-staging.apk | ||
asset_name: CGPABook-release-${{ steps.get_version.outputs.VERSION }}.apk | ||
asset_content_type: application/vnd.android.package-archive | ||
|
||
- name: Upload AAB | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.release-drafter.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./app/build/outputs/bundle/staging/app-staging.aab | ||
asset_name: CGPABook-release-${{ steps.get_version.outputs.VERSION }}.aab | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters