Skip to content

Commit

Permalink
Merge pull request #185 from rebelonion/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rebelonion authored Feb 7, 2024
2 parents a316de3 + 1e7b546 commit de17889
Show file tree
Hide file tree
Showing 410 changed files with 7,823 additions and 5,746 deletions.
86 changes: 74 additions & 12 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,50 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0


- name: Download last SHA artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: beta.yml
name: last-sha
path: .

continue-on-error: true

- name: Get Commits Since Last Run
run: |
if [ -f last_sha.txt ]; then
LAST_SHA=$(cat last_sha.txt)
else
# Fallback to first commit if no previous SHA available
LAST_SHA=$(git rev-list --max-parents=0 HEAD)
fi
echo "Commits since $LAST_SHA:"
# Accumulate commit logs in a shell variable
COMMIT_LOGS=$(git log $LAST_SHA..HEAD --pretty=format:"%h - %s")
# URL-encode the newline characters for GitHub Actions
COMMIT_LOGS="${COMMIT_LOGS//'%'/'%25'}"
COMMIT_LOGS="${COMMIT_LOGS//$'\n'/'%0A'}"
COMMIT_LOGS="${COMMIT_LOGS//$'\r'/'%0D'}"
# Append the encoded commit logs to the COMMIT_LOG environment variable
echo "COMMIT_LOG=${COMMIT_LOGS}" >> $GITHUB_ENV
# Debugging: Print the variable to check its content
echo "$COMMIT_LOGS"
shell: /usr/bin/bash -e {0}
env:
CI: true

- name: Save Current SHA for Next Run
run: echo ${{ github.sha }} > last_sha.txt

- name: Set variables
run: |
VER=$(grep -E -o "versionName \".*\"" app/build.gradle | sed -e 's/versionName //g' | tr -d '"')
SHA=${{ github.sha }}
VERSION="$VER.${SHA:0:7}"
VERSION="$VER+${SHA:0:7}"
echo "Version $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -31,30 +69,54 @@ jobs:
distribution: 'temurin'
java-version: 17
cache: gradle

- name: Decode Keystore File
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > $GITHUB_WORKSPACE/key.keystore

- name: List files in the directory
run: ls -l

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew assembleDebug -Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/key.keystore -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }}
run: ./gradlew assembleGoogleAlpha -Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/key.keystore -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }}

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: Dantotsu
path: "app/build/outputs/apk/debug/app-debug.apk"

- name: Upload APK to Discord
path: "app/build/outputs/apk/google/alpha/app-google-alpha.apk"
- name: Upload APK to Discord and Telegram
shell: bash
run: |
contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" )
curl -F "payload_json={\"content\":\" Debug-Build: <@719439449423085569> **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/debug/app-debug.apk" ${{ secrets.DISCORD_WEBHOOK }}
#Discord
commit_messages=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g')
# Truncate commit messages if they are too long
max_length=1900 # Adjust this value as needed
if [ ${#commit_messages} -gt $max_length ]; then
commit_messages="${commit_messages:0:$max_length}... (truncated)"
fi
contentbody=$( jq -nc --arg msg "Alpha-Build: <@719439449423085569> **$VERSION**:" --arg commits "$commit_messages" '{"content": ($msg + "\n" + $commits)}' )
curl -F "payload_json=${contentbody}" -F "dantotsu_debug=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" ${{ secrets.DISCORD_WEBHOOK }}
#Telegram
curl -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \
-F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
-F "caption=[Alpha-Build: ${VERSION}] Change logs :${commit_messages}" \
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
env:
COMMIT_LOG: ${{ env.COMMIT_LOG }}
VERSION: ${{ env.VERSION }}

- name: Upload Current SHA as Artifact
uses: actions/upload-artifact@v2
with:
name: last-sha
path: last_sha.txt


- name: Delete Old Pre-Releases
id: delete-pre-releases
Expand Down
4 changes: 4 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/build
/debug
/debug/output-metadata.json
/alpha
/alpha/output-metadata.json
/google/*
/fdroid/*
/release
47 changes: 35 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-android'
id 'kotlinx-serialization'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp'

}

def gitCommitHash = providers.exec {
Expand All @@ -20,14 +17,39 @@ android {
applicationId "ani.dantotsu"
minSdk 23
targetSdk 34
versionCode ((System.currentTimeMillis() / 60000).toInteger())
versionName "2.0.0-beta01-iv1"
versionCode((System.currentTimeMillis() / 60000).toInteger())
versionName "2.1.0"
versionCode 210000000
signingConfig signingConfigs.debug
}

flavorDimensions "store"
productFlavors {
fdroid {
// F-Droid specific configuration
dimension "store"
versionNameSuffix "-fdroid"
}
google {
// Google Play specific configuration
dimension "store"
isDefault true
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
}

buildTypes {
alpha {
applicationIdSuffix ".beta" // keep as beta by popular request
versionNameSuffix "-alpha01"
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_alpha", icon_placeholder_round: "@mipmap/ic_launcher_alpha_round"]
debuggable System.getenv("CI") == null
isDefault true
}
debug {
applicationIdSuffix ".beta"
versionNameSuffix "-beta01"
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_beta", icon_placeholder_round: "@mipmap/ic_launcher_beta_round"]
debuggable System.getenv("CI") == null
}
Expand All @@ -39,6 +61,7 @@ android {
}
buildFeatures {
viewBinding true
buildConfig true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -52,6 +75,11 @@ android {
}

dependencies {

// FireBase
googleImplementation platform('com.google.firebase:firebase-bom:32.2.3')
googleImplementation 'com.google.firebase:firebase-analytics-ktx:21.5.0'
googleImplementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.1'
// Core
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.browser:browser:1.7.0'
Expand All @@ -67,7 +95,7 @@ dependencies {
implementation 'com.github.Blatzar:NiceHttp:0.4.4'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.webkit:webkit:1.9.0'
implementation 'androidx.webkit:webkit:1.10.0'

// Glide
ext.glide_version = '4.16.0'
Expand All @@ -77,13 +105,8 @@ dependencies {
implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
implementation 'jp.wasabeef:glide-transformations:4.3.0'

// FireBase
implementation platform('com.google.firebase:firebase-bom:32.2.3')
implementation 'com.google.firebase:firebase-analytics-ktx:21.5.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.0'

// Exoplayer
ext.exo_version = '1.2.0'
ext.exo_version = '1.2.1'
implementation "androidx.media3:media3-exoplayer:$exo_version"
implementation "androidx.media3:media3-ui:$exo_version"
implementation "androidx.media3:media3-exoplayer-hls:$exo_version"
Expand Down
19 changes: 19 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1039200814590:android:40e14720ee97917e1aacaf",
"android_client_info": {
"package_name": "ani.dantotsu.alpha"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyCiXo_q4S2ofA5oCztsoLnlDqJi3GtTJjY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1039200814590:android:40e14720ee97917e1aacaf",
Expand Down
Loading

0 comments on commit de17889

Please sign in to comment.