first commit
This commit is contained in:
commit
3a891194f1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM alvrme/alpine-android:android-33-jdk11
|
||||
|
||||
RUN adduser -D build -u 1000
|
||||
RUN chown -R build:build /opt/sdk
|
||||
|
||||
WORKDIR /files
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
COPY build.sh Infinity.jks .
|
||||
|
||||
RUN chmod +x /docker-entrypoint.sh && \
|
||||
chmod +x build.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
BIN
Infinity.jks
Normal file
BIN
Infinity.jks
Normal file
Binary file not shown.
42
build.sh
Normal file
42
build.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd /build
|
||||
|
||||
if [ -d Infinity-For-Reddit ]
|
||||
then
|
||||
cd Infinity-For-Reddit
|
||||
git reset --hard master
|
||||
git pull origin master
|
||||
else
|
||||
git clone https://github.com/Docile-Alligator/Infinity-For-Reddit.git
|
||||
cd Infinity-For-Reddit
|
||||
fi
|
||||
|
||||
touch /build/previous_tag
|
||||
previous_tag=$(cat /build/previous_tag)
|
||||
latest_tag=$(git describe --tags)
|
||||
|
||||
[ "$previous_tag" = "$latest_tag" ] && exit 0
|
||||
|
||||
echo -n $latest_tag > /build/previous_tag
|
||||
git reset --hard $latest_tag
|
||||
|
||||
api_file=app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java
|
||||
sed -i "s|NOe2iKrPPzwscA|$API_TOKEN|" $api_file
|
||||
sed -i "s|infinity://localhost|$REDIRECT_URI|" $api_file
|
||||
sed -i -r "s|public static final String USER_AGENT = \".*?\";|public static final String USER_AGENT = \"android:personal-app:0.0.1 (by /u/$REDDIT_USERNAME)\";|g" $api_file
|
||||
|
||||
gradle_file=app/build.gradle
|
||||
sed -i "s| buildTypes {| signingConfigs {\n release {\n storeFile file(\"/files/Infinity.jks\")\n storePassword \"Infinity\"\n keyAlias \"Infinity\"\n keyPassword \"Infinity\"\n }\n }\n buildTypes {|" $gradle_file
|
||||
sed -i "s| minifyEnabled false| signingConfig signingConfigs.release\n minifyEnabled false|" $gradle_file
|
||||
|
||||
./gradlew assembleRelease
|
||||
|
||||
output_file=/build/Infinity-$latest_tag.apk
|
||||
mv app/build/outputs/apk/release/app-release.apk $output_file
|
||||
|
||||
curl \
|
||||
-F "payload_json={\"content\": \"A new version of Infinity is available ! ($previous_tag => $latest_tag)\"}" \
|
||||
-F "file=@$output_file" \
|
||||
$WEBHOOK_URL
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
infinity-build:
|
||||
container_name: infinity-build
|
||||
build: .
|
||||
command: ./build.sh
|
||||
environment:
|
||||
API_TOKEN:
|
||||
REDIRECT_URI:
|
||||
REDDIT_USERNAME:
|
||||
WEBHOOK_URL:
|
||||
volumes:
|
||||
- ./build:/build
|
6
docker-entrypoint.sh
Normal file
6
docker-entrypoint.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p /build
|
||||
chown build:build /build
|
||||
|
||||
su build -c "$@"
|
Loading…
x
Reference in New Issue
Block a user