Skip to content

Commit

Permalink
Update workflow action
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Jun 19, 2024
1 parent 6879428 commit ddaafcd
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 42 deletions.
59 changes: 22 additions & 37 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
git-ref:
description: Git Ref to build ('master' for preview build, any other for develop build)
description: Git Ref to build ('master' for standard preview build, any other for develop preview build)
required: false
dry-run:
description: Creates a draft release (any value would create a draft)
Expand All @@ -30,14 +30,14 @@ jobs:
CHANGELOG: ${{ steps.set_changelog.outputs.CHANGELOG }}
steps:
- name: Clone Repository (${{ github.event.inputs.git-ref }})
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'komikku-app/komikku'
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
uses: gradle/actions/wrapper-validation@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1

- name: Get previous release
id: last_release
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
build_type_name=Preview
else
tag_prefix=d
artifacts_prefix=dev/preview/app-dev
artifacts_prefix=standard/preview/app-standard
build_type_name="Dev build"
fi
echo "TAG_PREFIX=$tag_prefix" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -130,64 +130,60 @@ jobs:
needs: prepare-build
steps:
- name: Clone Repository (${{ github.event.inputs.git-ref }} - ${{ needs.prepare-build.outputs.TAG_PREFIX }}${{ needs.prepare-build.outputs.COMMIT_COUNT }})
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'komikku-app/komikku'
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}

- name: Set up gradle
uses: gradle/actions/setup-gradle@v3

- name: Setup Android SDK
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: 17
distribution: temurin

- name: Write changelog_debug.xml
uses: DamianReeves/write-file-action@v1.3

# Overwrite changelog with commits log if it's not a preview build
- name: Write changelog_preview.xml
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
if: github.event.inputs.git-ref != 'master'
with:
path: app/src/main/res/raw/changelog_debug.xml
path: app/src/main/res/raw/changelog_preview.xml
contents: "${{ needs.prepare-build.outputs.CHANGELOG }}"
write-mode: overwrite

- name: Write google-services.json
uses: DamianReeves/write-file-action@v1.3
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
if: github.event.inputs.git-ref == 'master'
with:
path: app/google-services.json
contents: ${{ secrets.GOOGLE_SERVICES_JSON }}
write-mode: overwrite

- name: Write client_secrets.json
uses: DamianReeves/write-file-action@v1.3
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
if: github.event.inputs.git-ref == 'master'
with:
path: app/src/main/assets/client_secrets.json
contents: ${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}
write-mode: overwrite

- name: Set up gradle
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1

# - name: Build app and run unit tests
# uses: gradle/gradle-command-action@v2
# with:
# arguments: detekt assembleStandardPreview testStandardPreviewUnitTest
# arguments: detekt assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest

- name: Build Preview APK
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest --stacktrace
if: github.event.inputs.git-ref == 'master'
- name: Build app and run unit tests
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace

- name: Build Development APK
run: ./gradlew assembleDevPreview testDevPreviewUnitTest --stacktrace
if: github.event.inputs.git-ref != 'master'

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: "**/*.apk"
retention-days: 1
Expand All @@ -199,7 +195,7 @@ jobs:
- build-app
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
merge-multiple: true

Expand All @@ -209,24 +205,13 @@ jobs:
- name: Sign APK
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
if: github.event.inputs.git-ref == 'master'
with:
releaseDirectory: app/build/outputs/apk/standard/preview
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Sign Development APK
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
if: github.event.inputs.git-ref != 'master'
with:
releaseDirectory: app/build/outputs/apk/dev/preview
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Get SHA & clean up build artifacts
id: get_sha
run: |
Expand Down Expand Up @@ -275,7 +260,7 @@ jobs:
| armeabi-v7a | ${{ steps.get_sha.outputs.APK_ARMEABI_V7A_SHA }} |
| x86 | ${{ steps.get_sha.outputs.APK_X86_SHA }} |
| x86_64 | ${{ steps.get_sha.outputs.APK_X86_64_SHA }} |
## If you are unsure which apk to download then go with Komikku-${{ needs.prepare-build.outputs.TAG_PREFIX }}${{ needs.prepare-build.outputs.COMMIT_COUNT }}.apk
files: |
Komikku-${{ needs.prepare-build.outputs.TAG_PREFIX }}${{ needs.prepare-build.outputs.COMMIT_COUNT }}.apk
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: PR build check
on:
pull_request:
paths-ignore:
- '**.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build app
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'komikku-app/komikku'
ref: 'master'

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1

- name: Dependency Review
uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3

- name: Setup Android SDK
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: 17
distribution: temurin

- name: Write google-services.json
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
with:
path: app/google-services.json
contents: ${{ secrets.GOOGLE_SERVICES_JSON }}
write-mode: overwrite

- name: Write client_secrets.json
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
with:
path: app/src/main/assets/client_secrets.json
contents: ${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}
write-mode: overwrite

- name: Set up gradle
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83 # v3.4.1

- name: Build app and run unit tests
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
14 changes: 9 additions & 5 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"baseBranches": ["main"],
"baseBranches": [
"main"
],
"rebaseWhen": "conflicted",
"labels": ["Dependencies"],
"labels": [
"Dependencies"
],
"automerge": true,
"extends": [
["config:best-practices"]
],
"includeForks": true
"config:best-practices",
"github>mihonapp/mihon//.github/renovate.json5"
]
}

0 comments on commit ddaafcd

Please sign in to comment.