Skip to content

Switch on new-arch #5246

Switch on new-arch

Switch on new-arch #5246

Workflow file for this run

name: Build Android and iOS
on: push
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup caching
if: startsWith(github.ref, 'refs/tags') == false
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: cache-${{ runner.OS }}-${{ hashFiles('**/*.lock') }}
restore-keys: |
cache-${{ runner.OS }}-
- uses: actions/setup-java@v3
with:
distribution: 'corretto' # See 'Supported distributions' for available options
java-version: '21'
- name: Install dependencies
run: |
yarn
- name: Prepare for building
env:
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
run: |
openssl aes-256-cbc -k "$SECRET_PASSWORD" -in apps/thu-info-app/android/app/THUInfo.jks.enc -out apps/thu-info-app/android/app/THUInfo.jks -d
- name: Build android release
uses: gradle/gradle-build-action@v2
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
SIGNATURE_DIGEST: ${{ secrets.SIGNATURE_DIGEST }}
with:
arguments: assembleRelease
build-root-directory: apps/thu-info-app/android
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk
- name: Prepare for release
id: prepare_release
if: startsWith(github.ref, 'refs/tags')
run: |
export ref='${{ github.ref }}'
export tag=${ref:10}
echo "::set-output name=tag::$tag"
mv apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk THUInfo_release_${tag}.apk
- name: Prepare for building (allow rooted)
run: |
sed -i "/preventRoot/d" apps/thu-info-app/android/app/src/main/java/com/unidy2002/thuinfo/MainApplication.kt
- name: Build android release (allow rooted)
uses: gradle/gradle-build-action@v2
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
SIGNATURE_DIGEST: ${{ secrets.SIGNATURE_DIGEST }}
with:
arguments: assembleRelease
build-root-directory: apps/thu-info-app/android
- name: Upload artifact (allow rooted)
uses: actions/upload-artifact@v3
with:
name: app-release-allow-rooted.apk
path: apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk
- name: Prepare for release (allow rooted)
if: startsWith(github.ref, 'refs/tags')
run: |
export ref='${{ github.ref }}'
export tag=${ref:10}
mv apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk THUInfo_release_${tag}_allow_rooted.apk
- name: Create Release
if: startsWith(github.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: ./release
- name: Upload to GitHub release
if: startsWith(github.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: THUInfo_release_${{ steps.prepare_release.outputs.tag }}.apk
asset_name: THUInfo_release_${{ steps.prepare_release.outputs.tag }}.apk
asset_content_type: 'application/vnd.android.package-archive'
- name: Upload to GitHub release (allow rooted)
if: startsWith(github.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: THUInfo_release_${{ steps.prepare_release.outputs.tag }}_allow_rooted.apk
asset_name: THUInfo_release_${{ steps.prepare_release.outputs.tag }}_allow_rooted.apk
asset_content_type: 'application/vnd.android.package-archive'