Skip to content

Commit

Permalink
fix: Always build from clean clone
Browse files Browse the repository at this point in the history
The previous build script was using artifacts from the local
build in the podman container for signing rather than the ones
produced by the container compilation.
  • Loading branch information
Leander Beernaert committed Jan 5, 2025
1 parent 0669c49 commit b28dc3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ RUN yes | sdkmanager --licenses --sdk_root=$ANDROID_HOME && \
# Install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_VERSION"

# Install git
RUN apt-get install -y git

# Cleanup
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
apt-get autoremove -y && \
Expand Down
6 changes: 6 additions & 0 deletions scripts/build-podman-exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ ALIGNED="/tmp/app-aligned.apk"

source ~/.cargo/env

echo "Cloning repo"
git clone "https://github.com/LeanderBB/you-have-mail.git" /opt/project

cd /opt/project/you-have-mail-android

# Build Project
./gradlew --no-daemon assembleRelease

# Align zip
echo "Aligning apk"
$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign -v 4 \
app/build/outputs/apk/release/app-release-unsigned.apk $ALIGNED

# Sign apk
echo "Signing apk"
echo $KEY_STORE_PWD | $ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner sign \
--ks /opt/keystore \
--in $ALIGNED \
--out $OUTPUT

# Verify
echo "Verifying apk"
$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner verify $OUTPUT

6 changes: 1 addition & 5 deletions scripts/build-podman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@ set -eou pipefail

mkdir -p artifacts

podman run --rm --volume $PWD:/opt/project:Z \
--volume $PWD/artifacts:/opt/artifacts:rw \
--secret android_keystore,type=mount,target=/opt/keystore \
--secret android_key_pwd,type=env,target=KEY_STORE_PWD \
-i -t yhm "/opt/project/scripts/build-podman-exec.sh"
scripts/podman-do.sh "/opt/scripts/build-podman-exec.sh"

0 comments on commit b28dc3c

Please sign in to comment.