Skip to content

Commit

Permalink
Merge pull request #293 from astubenbord/feature/f-droid
Browse files Browse the repository at this point in the history
Feature: Reproducible Builds for F-Droid
  • Loading branch information
astubenbord authored Oct 28, 2023
2 parents 03d8cb5 + a72f96e commit 93bb38b
Show file tree
Hide file tree
Showing 72 changed files with 245 additions and 207 deletions.
6 changes: 6 additions & 0 deletions .github/actions/setup-android-signing-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
keystore-store-password:
description: 'key.properties storePassword'
required: true
output-directory:
description: The directory of the project
required: true

runs:
using: "composite"
steps:
Expand All @@ -26,5 +30,7 @@ runs:
echo "keyAlias=${{ inputs.keystore-key-alias }}" >> key.properties
echo "storePassword=${{ inputs.keystore-store-password }}" >> key.properties
echo "keyPassword=${{ inputs.keystore-key-password }}" >> key.properties
cp key.properties ${{ inputs.output-directory }}/key.properties
cp app/${{ inputs.keystore-key-alias }}-keystore.jks ${{ inputs.output-directory }}/app
shell: bash
working-directory: android
42 changes: 26 additions & 16 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,30 @@ jobs:
runs-on: ubuntu-latest
steps:
# Setup Ruby, Bundler, and Gemfile dependencies

- name: Create build directory
run: mkdir -p /tmp/build

- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch

- name: Checkout repository
uses: actions/checkout@v3

- name: Clone flutter repository
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.3'
channel: stable
- run: flutter doctor -v
fetch-depth: 0
submodules: recursive

- name: Copy files to build directory
run: |
mkdir -p /tmp/build
cp -R . /tmp/build
- name: Set FLUTTER_ROOT environment variable and build dir
run: echo "FLUTTER_ROOT=/tmp/build/flutter/bin" >> $GITHUB_ENV

- run: $FLUTTER_ROOT/flutter doctor -v

- name: Setup signing config
uses: ./.github/actions/setup-android-signing-config
with:
Expand All @@ -41,21 +49,23 @@ jobs:
keystore-store-password: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
release-keystore: ${{ secrets.RELEASE_KEYSTORE }}
release-keystore-passphrase: ${{ secrets.RELEASE_KEYSTORE_PASSPHRASE }}

output-directory: /tmp/build/android

- name: Get packages and run codegen
run: |
bash install_dependencies.sh
bash update_changelogs.sh
working-directory: scripts
bash /tmp/build/scripts/install_dependencies_with_submodule.sh
bash /tmp/build/scripts/update_changelogs.sh
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
bundler-cache: true
working-directory: android

- run: bundle exec fastlane github branch:${{ steps.extract_branch.outputs.branch }} is_draft:${{ github.event.inputs.is_draft }}
working-directory: /tmp/build/android

- name: Build and publish GitHub release
run: |
cd /tmp/build/android
bundle exec fastlane github branch:${{ steps.extract_branch.outputs.branch }} is_draft:${{ github.event.inputs.is_draft }}
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
working-directory: android
16 changes: 8 additions & 8 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
name: "Deploy to Stores and create GitHub release"
runs-on: ubuntu-latest
steps:


- name: Extract branch name
shell: bash
Expand All @@ -38,13 +37,14 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v3

- name: Clone flutter repository
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.3'
channel: stable
- run: flutter doctor -v
fetch-depth: 0
submodules: recursive

- name: Set FLUTTER_ROOT environment variable
run: echo "FLUTTER_ROOT=$(pwd)/flutter/bin" >> $GITHUB_ENV

- run: $FLUTTER_ROOT/flutter doctor -v

- name: Setup signing config
uses: ./.github/actions/setup-android-signing-config
Expand All @@ -57,7 +57,7 @@ jobs:

- name: Get packages and run codegen
run: |
bash install_dependencies.sh
bash install_dependencies_with_submodule.sh
bash update_changelogs.sh
working-directory: scripts

Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release-deploy-play-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v3

- name: Clone flutter repository
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.3'
channel: stable
- run: flutter doctor -v
fetch-depth: 0
submodules: recursive

- name: Set FLUTTER_ROOT environment variable
run: echo "FLUTTER_ROOT=$(pwd)/flutter/bin" >> $GITHUB_ENV

- run: $FLUTTER_ROOT/flutter doctor -v

- name: Setup signing config
uses: ./.github/actions/setup-android-signing-config
Expand All @@ -51,7 +52,7 @@ jobs:

- name: Get packages and run codegen
run: |
bash install_dependencies.sh
bash install_dependencies_with_submodule.sh
bash update_changelogs.sh
working-directory: scripts

Expand Down
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "flutter"]
path = flutter
url = https://github.com/flutter/flutter
branch = stable
13 changes: 12 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,16 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Required for flutter_local_notifications
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

}

ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def abiName = output.getFilter(OutputFile.ABI)
def abiVersionCode = project.ext.abiCodes.get(abiName)
if (abiVersionCode != null) {
output.versionCodeOverride = variant.versionCode * 10 + abiVersionCode
}
}
}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.7.0'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// implementation 'androidx.window:window:1.0.0'
// implementation 'androidx.window:window-java:1.0.0'
Expand Down
6 changes: 3 additions & 3 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ platform :android do |options|
lane :publish_in_play_store do |options|
release_status = (options[:is_draft] ? "draft" : "completed")
track = (options[:track])
sh "flutter build appbundle -v"
sh "$FLUTTER_ROOT/flutter build appbundle -v"
upload_to_play_store(
track: track,
release_status: release_status,
Expand All @@ -47,8 +47,8 @@ platform :android do |options|

desc "Builds apks and creates a new release on GitHub"
lane :github do |options|
sh "flutter build apk --split-per-abi --release"
sh "flutter build apk --release"
sh "$FLUTTER_ROOT/flutter build apk --split-per-abi --release"
sh "$FLUTTER_ROOT/flutter build apk --release"
set_github_release(
repository_name: "astubenbord/paperless-mobile",
api_token: ENV["GH_ACCESS_TOKEN"],
Expand Down
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/de-DE/changelogs/55.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Hinzufügen von Build-Skript für F-Droid
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/de-DE/changelogs/56.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* F-Droid build
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/55.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add build script for F-Droid
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/56.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* F-Droid build
3 changes: 1 addition & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
16 changes: 0 additions & 16 deletions assets/images/bmc-logo.svg

This file was deleted.

Binary file removed assets/images/documents_headache.png
Binary file not shown.
Loading

0 comments on commit 93bb38b

Please sign in to comment.