Skip to content

Commit 82cf57b

Browse files
authored
Update Workflow and README.md (#6)
1 parent 91f80cb commit 82cf57b

File tree

4 files changed

+61
-40
lines changed

4 files changed

+61
-40
lines changed

.github/workflows/release.yaml

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
env:
13-
file: app-release-unsigned.apk
14-
name: ${{ github.repository_owner }}.apk
15-
path: app/build/outputs/apk/release
13+
path: app/build/outputs/apk/release # Output Path
14+
output: app-release-unsigned.apk # Output File Name
15+
name: ${{ github.repository_owner }}.apk # Final APK Name
1616
key_name: my-key
1717
key_file: release.keystore
1818
tools_path: /usr/local/lib/android/sdk/build-tools/36.0.0
19+
cmdline_tools: /usr/local/lib/android/sdk/cmdline-tools/latest/bin
1920

2021
jobs:
2122
release:
@@ -29,36 +30,38 @@ jobs:
2930
- name: "Checkout"
3031
uses: actions/checkout@v4
3132

32-
- name: "Debug event.json"
33+
- name: "Debug Event"
3334
if: ${{ !github.event.act }}
3435
continue-on-error: true
3536
run: |
37+
echo "ref: ${{ github.ref }}"
38+
echo "event_name: ${{ github.event_name }}"
39+
40+
echo "::group::cat event.json"
3641
cat "${GITHUB_EVENT_PATH}"
42+
echo "::endgroup::"
3743
3844
- name: "Set Tools Path"
3945
if: ${{ !github.event.act }}
4046
run: |
4147
echo "${{ env.tools_path }}" >> "$GITHUB_PATH"
48+
echo "${{ env.cmdline_tools }}" >> "$GITHUB_PATH"
4249
43-
- name: "Debug Tools"
50+
- name: "Verify Tools"
4451
if: ${{ !github.event.act }}
45-
continue-on-error: true
4652
run: |
47-
echo "tools_path: ${{ env.tools_path }}"
53+
which keytool
54+
which zipalign
55+
which apksigner
56+
which apkanalyzer
4857
4958
echo "::group::PATH"
5059
echo "${PATH}"
5160
echo "::endgroup::"
52-
53-
echo "::group::ls env.tools_path"
54-
ls -lAh "${{ env.tools_path }}/"
61+
echo "::group::ls tools_path"
62+
ls -lAh "${{ env.tools_path }}"
5563
echo "::endgroup::"
5664
57-
echo "--------------------"
58-
which keytool
59-
which zipalign
60-
which apksigner
61-
6265
- name: "Update Version"
6366
uses: chkfung/[email protected]
6467
with:
@@ -70,7 +73,12 @@ jobs:
7073
if: ${{ !github.event.act }}
7174
continue-on-error: true
7275
run: |
73-
cat "app/build.gradle.kts"
76+
echo "versionCode: ${{ github.run_number }}"
77+
echo "versionName: ${{ github.ref_name }}"
78+
79+
echo "::group::cat app/build.gradle.kts"
80+
cat app/build.gradle.kts
81+
echo "::endgroup::"
7482
7583
- name: "Setup Java"
7684
uses: actions/setup-java@v4
@@ -82,23 +90,24 @@ jobs:
8290
- name: "Set Gradle Executable"
8391
run: chmod +x ./gradlew
8492

85-
- name: "Gradlew Assemble"
93+
- name: "Gradle Assemble"
8694
run: ./gradlew assembleRelease
8795

88-
- name: "Debug Build"
89-
continue-on-error: true
96+
- name: "Verify Build"
9097
run: |
91-
echo "ref: ${{ github.ref }}"
92-
echo "path: ${{ env.path }}"
93-
echo "path/name: ${{ env.path }}/${{ env.name }}"
94-
98+
apkanalyzer -h apk summary "${{ env.path }}/${{ env.output }}"
99+
95100
echo "::group::ls env.path"
96101
ls -lAh ${{ env.path }}
97102
echo "::endgroup::"
98103
99104
- name: "Align APK"
100105
run: |
101-
zipalign -v 4 "${{ env.path }}/${{ env.file }}" "${{ env.path }}/${{ env.name }}"
106+
zipalign -P 16 -f -v 4 "${{ env.path }}/${{ env.output }}" "${{ env.path }}/${{ env.name }}"
107+
108+
- name: "Verify Alignment"
109+
run: |
110+
zipalign -c -P 16 -v 4 "${{ env.path }}/${{ env.name }}"
102111
103112
- name: "Decode Keystore"
104113
run: |
@@ -107,8 +116,7 @@ jobs:
107116
- name: "Debug Keystore"
108117
continue-on-error: true
109118
run: |
110-
stat ${{ env.key_file }}
111-
keytool -list -keystore ${{ env.key_file }}
119+
echo ${{ secrets.ANDROID_KEYSTORE_PASS }} | keytool -list -keystore ${{ env.key_file }}
112120
113121
- name: "Sign APK"
114122
run: |
@@ -149,19 +157,13 @@ jobs:
149157
uses: smashedr/update-release-notes-action@master
150158
continue-on-error: true
151159

152-
- name: "Send Failure Notification"
153-
if: ${{ failure() && github.event_name == 'release' }}
154-
uses: sarisia/actions-status-discord@v1
155-
with:
156-
webhook: ${{ secrets.DISCORD_WEBHOOK }}
157-
158-
- name: "Job Summary"
160+
- name: "Write Job Summary"
159161
if: ${{ !github.event.act }}
160162
continue-on-error: true
161163
run: |
162164
echo -e "## Android Release\n\n" >> $GITHUB_STEP_SUMMARY
163165
164-
echo -e "Signed APK: \`${{ env.name }}\`\n\n" >> $GITHUB_STEP_SUMMARY
166+
echo -e "Final APK: \`${{ env.name }}\`\n\n" >> $GITHUB_STEP_SUMMARY
165167
166168
echo -e "<details><summary>Build Artifacts</summary>\n\n" >> $GITHUB_STEP_SUMMARY
167169
echo -e "\`\`\`text\n$(ls -lAh ${{ env.path }})\n\`\`\`\n\n" >> $GITHUB_STEP_SUMMARY
@@ -174,3 +176,9 @@ jobs:
174176
fi
175177
176178
echo -e "\n\n---" >> $GITHUB_STEP_SUMMARY
179+
180+
- name: "Send Failure Notification"
181+
if: ${{ failure() && github.event_name == 'release' }}
182+
uses: sarisia/actions-status-discord@v1
183+
with:
184+
webhook: ${{ secrets.DISCORD_WEBHOOK }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Django Files Android App
1313

14-
[![GitHub Release](https://img.shields.io/github/v/release/django-files/android-client?style=for-the-badge&logo=android&label=Download%20Latest%20APK&color=A4C639)](https://github.com/django-files/android-client/releases/latest/download/django-files.apk)
14+
[![GitHub Release](https://img.shields.io/github/v/release/django-files/android-client?style=for-the-badge&logo=android&label=Download%20for%20Android&color=A4C639)](https://github.com/django-files/android-client/releases/latest/download/django-files.apk)
1515

1616
- [Install](#Install)
1717
- [Setup](#Setup)
@@ -42,7 +42,7 @@ The URL to the file is automatically copied to the clipboard and the preview is
4242
> [!TIP]
4343
> To install, download and open the [latest release](https://github.com/django-files/android-client/releases/latest).
4444
>
45-
> [![GitHub Release](https://img.shields.io/github/v/release/django-files/android-client?style=for-the-badge&logo=android&label=Download%20Latest%20APK&color=A4C639)](https://github.com/django-files/android-client/releases/latest/download/django-files.apk)
45+
> [![GitHub Release](https://img.shields.io/github/v/release/django-files/android-client?style=for-the-badge&logo=android&label=Download%20for%20Android&color=A4C639)](https://github.com/django-files/android-client/releases/latest/download/django-files.apk)
4646
4747
_Note: Until published on the play store, you may need to allow installation of apps from unknown sources._
4848

app/src/main/java/com/djangofiles/djangofiles/MainActivity.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.os.Build
1010
import android.os.Bundle
1111
import android.provider.OpenableColumns
1212
import android.util.Log
13+
import android.view.Gravity
1314
import android.view.KeyEvent
1415
import android.view.View
1516
import android.webkit.WebResourceError
@@ -19,6 +20,7 @@ import android.webkit.WebView
1920
import android.webkit.WebViewClient
2021
import android.widget.EditText
2122
import android.widget.LinearLayout
23+
import android.widget.TextView
2224
import android.widget.Toast
2325
import androidx.activity.enableEdgeToEdge
2426
import androidx.appcompat.app.AlertDialog
@@ -55,6 +57,8 @@ class MainActivity : AppCompatActivity() {
5557
private lateinit var webView: WebView
5658
private val client = OkHttpClient()
5759

60+
private var versionName: String? = null
61+
5862
@SuppressLint("SetJavaScriptEnabled")
5963
override fun onCreate(savedInstanceState: Bundle?) {
6064
super.onCreate(savedInstanceState)
@@ -68,9 +72,10 @@ class MainActivity : AppCompatActivity() {
6872
webView.settings.javaScriptEnabled = true
6973

7074
val packageInfo = packageManager.getPackageInfo(this.packageName, 0)
71-
Log.d("MY_APP_TAG", "versionName: ${packageInfo.versionName}")
75+
versionName = packageInfo.versionName
76+
Log.d("MY_APP_TAG", "versionName: $versionName")
7277
val userAgent =
73-
"${webView.settings.userAgentString} DjangoFiles Android/${packageInfo.versionName}"
78+
"${webView.settings.userAgentString} DjangoFiles Android/${versionName}"
7479
Log.d("onCreate", "UA: $userAgent")
7580

7681
webView.settings.userAgentString = userAgent
@@ -238,7 +243,7 @@ class MainActivity : AppCompatActivity() {
238243
// Inflate custom layout with padding
239244
val layout = LinearLayout(this)
240245
layout.orientation = LinearLayout.VERTICAL
241-
layout.setPadding(5, 0, 5, 120)
246+
layout.setPadding(5, 0, 5, 80)
242247

243248
val input = EditText(this)
244249
input.inputType = android.text.InputType.TYPE_CLASS_TEXT
@@ -248,12 +253,19 @@ class MainActivity : AppCompatActivity() {
248253
if (savedUrl != null) {
249254
input.setText(savedUrl)
250255
}
256+
257+
val text = TextView(this)
258+
text.text = getString(R.string.settings_requires)
259+
text.gravity = Gravity.CENTER_HORIZONTAL
260+
text.setPadding(0, 20, 0, 0)
261+
layout.addView(text)
262+
251263
input.requestFocus()
252264

253265
runOnUiThread {
254266
AlertDialog.Builder(this)
255267
.setCancelable(false)
256-
.setTitle(getString(R.string.settings_title))
268+
.setTitle("${getString(R.string.app_name)} v$versionName")
257269
.setMessage(getString(R.string.settings_message))
258270
.setView(layout)
259271
.setNegativeButton("Exit") { dialog: DialogInterface?, which: Int -> finish() }

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<string name="settings_title">App Settings</string>
55
<string name="settings_message">Set or Change the Django Files URL</string>
66
<string name="settings_input_place">your.django-files.com</string>
7+
<string name="settings_requires">Requires server version 0.16.0-b7 or greater.</string>
78
<string name="tst_invalid_url">Please enter a valid URL.</string>
89

910
<string name="tst_not_implemented">Not Implemented.</string>

0 commit comments

Comments
 (0)