Skip to content

Commit

Permalink
Auto upload release on tag and up version to 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-paing committed Aug 26, 2023
1 parent cea801d commit 228ba5f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 63 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
run: |
touch release.keystore
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Decrypt google service json
run: |
TMP_GOOGLE_SERVICE_JSON_DIR="${RUNNER_TEMP}"/play
Expand Down Expand Up @@ -68,6 +71,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Stub release keystore file
run: |
touch release.keystore
Expand Down
87 changes: 25 additions & 62 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,30 @@ on:
push:
tags:
- '*'

jobs:
test:
name: Static Code Check & Test
runs-on: ubuntu-22.04
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CCDROIDX_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEYSTORE_PASSWORD }}
CCDROIDX_RELEASE_KEY_ALIAS: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS }}
CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD }}
CCDROIDX_RELEASE_KEYSTORE_PATH: release.keystore
ENCRYPTED_KEY_STORE: ${{ secrets.ENCRYPTED_KEY_STORE }}
GOOGLE_SERVICE_JSON: ${{ secrets.GOOGLE_SERVICE_JSON }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Checkout
uses: actions/checkout@v3

- name: Stub release keystore file
run: |
touch release.keystore
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Decrypt google service json
run: |
Expand All @@ -34,61 +36,22 @@ jobs:
echo $GOOGLE_SERVICE_JSON | base64 -di > "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json
mv "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json app/google-services.json
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Lint check
run: ./gradlew lintDebug

- name: Unit Test
run: ./gradlew testDebugUnitTest

create_apk:
needs: test
name: Deploy APK
runs-on: ubuntu-22.04
env:
CCDROIDX_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEYSTORE_PASSWORD }}
CCDROIDX_RELEASE_KEY_ALIAS: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS }}
CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD }}
CCDROIDX_RELEASE_KEYSTORE_PATH: release.keystore
ENCRYPTED_KEY_STORE: ${{ secrets.ENCRYPTED_KEY_STORE }}
GOOGLE_SERVICE_JSON: ${{ secrets.GOOGLE_SERVICE_JSON }}
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
distribution: 'temurin'
java-version: '11'

- name: Decrypt keystore
run: |
TMP_KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore
mkdir "${TMP_KEYSTORE_FILE_PATH}"
echo $ENCRYPTED_KEY_STORE | base64 -di > "${TMP_KEYSTORE_FILE_PATH}"/release.keystore
mv "${TMP_KEYSTORE_FILE_PATH}"/release.keystore release.keystore
- name: Decrypt google service json
run: |
TMP_GOOGLE_SERVICE_JSON_DIR="${RUNNER_TEMP}"/play
mkdir "${TMP_GOOGLE_SERVICE_JSON_DIR}"
echo $GOOGLE_SERVICE_JSON | base64 -di > "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json
mv "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json app/google-services.json
- name: Build APK
run: ./gradlew assembleRelease

- name: Copy APK to outputs
run: |
mkdir -p outputs/
find . -type f -regex ".*\/*\.apk" -exec cp {} outputs/ \;
- name: Build app
run: ./gradlew assembleFlossRelease assembleFullRelease

- name: Create Artifact
uses: actions/upload-artifact@v3
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Builds
path: outputs/*.apk
draft: true
prerelease: false
files: '**/ccdroidx-*-release.apk'
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val minimumSdkVer by extra { 28 }

private val versionMajor = 1
private val versionMinor = 2
private val versionPatch = 0
private val versionPatch = 1
private val versionBuild = 0
val versionNameConfig by extra { "$versionMajor.$versionMinor.$versionPatch" }
val versionCodeConfig by extra { versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild * 10 }
Expand Down

0 comments on commit 228ba5f

Please sign in to comment.