diff --git a/.github/workflows/make-apk.yml b/.github/workflows/make-apk.yml index fa097b2..6457576 100644 --- a/.github/workflows/make-apk.yml +++ b/.github/workflows/make-apk.yml @@ -9,17 +9,19 @@ jobs: Build-Apk: runs-on: ubuntu-latest steps: - - name: Install nix - uses: cachix/install-nix-action@v15 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Cache Nix store + - name: Cache fontforge and extra dependencies uses: actions/cache@v2 with: - path: /nix - key: nix-store - - name: Install external dependencies - run: nix-env -f '' -i fontforge + path: /usr/local/bin + key: usr-local-bin + - name: Install latest FontForge version (using AppImage) + run: | + # Get most recent version of FontForge + # Using AppImage there is no dependecy problem, it is the latest version and it's easier to cache + cd /usr/local/bin + sudo wget -c -N https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage + sudo chmod +x ./FontForge-2022-03-08-582bd41-x86_64.AppImage + sudo ln --symbolic --force /usr/local/bin/FontForge-2022-03-08-582bd41-x86_64.AppImage /usr/local/bin/fontforge - uses: actions/setup-java@v2 with: distribution: 'zulu' # See 'Supported distributions' for available options @@ -31,6 +33,19 @@ jobs: with: path: _build/debug.keystore key: debug-keystore + - name: Restore debug keystore from github Secrets + run: | + mkdir -p _build + cd "$GITHUB_WORKSPACE/_build" + # Check if exist and use the secret named DEBUG_KEYSTORE + # The contents of the secret can be obtained - + # from the debug.keystore.asc from you local _build folder + if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" == "" ]]; then + echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc" + if [[ -s "debug.keystore.asc" ]]; then + gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore" + fi + fi - name: Build run: make - name: Save debug apk diff --git a/.gitignore b/.gitignore index 23cc817..8a08a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.keystore +*.keystore.asc _build /*-keystore.conf diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5caaa7e..d36ec97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,24 @@ make If the build succeed, the debug apk is located in `_build/juloo.keyboard2.debug.apk`. +## Using the local debug.keystore on the Github CI actions + +It's possible to save the local debug.keystore into a github secret, so the same keystore is utilized to build the debug apk in the CI github actions. +Doing this, they wil have the same signature, thus the debug apk can be updated without having to uninstall it first. + +After you sucessfully run `make`, (thus a debug.keystore exists) you can use this second command to generate a base64 stringified version of it + +```sh +cd _build +gpg -c --armor --pinentry-mode loopback --passphrase debug0 --yes "debug.keystore" +``` + +A file will be generated inside the local `_build/` folder, called `debug.keystore.asc` + +You can copy the content of this file, and with that, paste it into a new github secret in your repo settings. + +The secret must be named `DEBUG_KEYSTORE` + ## Debugging on your phone First [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb#Enabling). diff --git a/Makefile b/Makefile index bfb633b..6ad91b8 100644 --- a/Makefile +++ b/Makefile @@ -97,12 +97,12 @@ $(R_FILE): $(RES_FILES) $(MANIFEST_FILE) # Special font -SPECIAL_FONT_GLYPHS = $(wildcard srcs/special_font/*.svg) -SPECIAL_FONT_SCRIPT = srcs/special_font/build.pe +SPECIAL_FONT_GLYPHS = $(wildcard $(CURDIR)/srcs/special_font/*.svg) +SPECIAL_FONT_SCRIPT = $(CURDIR)/srcs/special_font/build.pe _build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS) mkdir -p $(@D) - fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $@ $(SPECIAL_FONT_GLYPHS) + fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $(CURDIR)/$@ $(SPECIAL_FONT_GLYPHS) # Compile java classes and build classes.dex