From 01aff4a6957c4bc902fe7eb9a27b535e1620eeac Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 20:45:47 +0200 Subject: [PATCH 01/24] Signing. --- .drone.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b401477..b36d78b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,4 +18,30 @@ steps: - name: build image: mingc/android-build-box:latest commands: - - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false \ No newline at end of file + - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + + +--- +kind: pipeline +type: docker +name: Deploy + +steps: + - name: build-and-sign + image: mingc/android-build-box:latest + commands: + - ./gradlew :androidApp:assembleRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + - wget https://amine-louveau.fr/testtest_everywhere + - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./testtest_everywhere -storepass YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk YOUR_KEY_ALIAS + - $ANDROID_HOME/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - $ANDROID_HOME/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + environment: + YOUR_KEYSTORE_PASSWORD: + from_secret: YOUR_KEYSTORE_PASSWORD + YOUR_KEY_ALIAS: + from_secret: YOUR_KEY_ALIAS + + +trigger: + branch: + - drone-sigh \ No newline at end of file -- 2.34.1 From 720dd72155c27a61164d9c315c316ac1fee68026 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 20:59:03 +0200 Subject: [PATCH 02/24] Changes. --- .drone.yml | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/.drone.yml b/.drone.yml index b36d78b..bae5eeb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,45 +1,21 @@ kind: pipeline type: docker -name: android - -steps: - - name: code-analysis - image: mingc/android-build-box:latest - failure: ignore - commands: - - ls -la - - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" - environment: - SONAR_HOST_URL: - from_secret: sonarScannerHostUrl - SONAR_LOGIN: - from_secret: sonarScannerLogin - - - name: build - image: mingc/android-build-box:latest - commands: - - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - - ---- -kind: pipeline -type: docker name: Deploy steps: - name: build-and-sign image: mingc/android-build-box:latest commands: - - ./gradlew :androidApp:assembleRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/testtest_everywhere - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./testtest_everywhere -storepass YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk YOUR_KEY_ALIAS - - $ANDROID_HOME/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - - $ANDROID_HOME/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - $ANDROID_HOME/sdk/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - $ANDROID_HOME/sdk/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk environment: YOUR_KEYSTORE_PASSWORD: - from_secret: YOUR_KEYSTORE_PASSWORD + from_secret: keyPass YOUR_KEY_ALIAS: - from_secret: YOUR_KEY_ALIAS + from_secret: keyAlias trigger: -- 2.34.1 From e81cf4d12ec244fd6fcc8513b6a05780f46d60b3 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:19:45 +0200 Subject: [PATCH 03/24] Build. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index bae5eeb..b54a17c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,8 +7,8 @@ steps: image: mingc/android-build-box:latest commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - - wget https://amine-louveau.fr/testtest_everywhere - - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./testtest_everywhere -storepass YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk YOUR_KEY_ALIAS + - wget https://amine-louveau.fr/key + - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk YOUR_KEY_ALIAS - $ANDROID_HOME/sdk/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - $ANDROID_HOME/sdk/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk environment: -- 2.34.1 From 1416be9f2c9c4aa4f194056ab1e781bee380bdf9 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:29:12 +0200 Subject: [PATCH 04/24] Fixed issue. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b54a17c..72e7573 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ steps: commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk YOUR_KEY_ALIAS + - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS - $ANDROID_HOME/sdk/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - $ANDROID_HOME/sdk/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk environment: -- 2.34.1 From a2f4eac482451e75cd7dc676b524560ef6b258a3 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:38:41 +0200 Subject: [PATCH 05/24] Path --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 72e7573..8c6e5a8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,8 @@ steps: commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS + - ls -la $ANDROID_HOME/build-tools + - ls -la $ANDROID_HOME/sdk/build-tools - $ANDROID_HOME/sdk/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - $ANDROID_HOME/sdk/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk environment: -- 2.34.1 From 73b391cc72cbffb7d6f250337795d73757f5f673 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:47:23 +0200 Subject: [PATCH 06/24] Should be done. --- .drone.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8c6e5a8..e68f572 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,10 +8,9 @@ steps: commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - - ls -la $ANDROID_HOME/build-tools - - ls -la $ANDROID_HOME/sdk/build-tools - - $ANDROID_HOME/sdk/build-tools/version/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - - $ANDROID_HOME/sdk/build-tools/version/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS + - $ANDROID_HOME/build-tools/31.0.0/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - $ANDROID_HOME/build-tools/31.0.0/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk environment: YOUR_KEYSTORE_PASSWORD: from_secret: keyPass -- 2.34.1 From 2d40ab07eb78ded08b3f1e628e4a31e6ee957138 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:52:23 +0200 Subject: [PATCH 07/24] Whole thing. --- .drone.yml | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index e68f572..563e6f6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,60 @@ kind: pipeline type: docker +name: android + +steps: + - name: code-analysis + image: mingc/android-build-box:latest + failure: ignore + commands: + - ls -la + - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" + environment: + SONAR_HOST_URL: + from_secret: sonarScannerHostUrl + SONAR_LOGIN: + from_secret: sonarScannerLogin + + - name: build + image: mingc/android-build-box:latest + commands: + - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + + - name: saveBuild + image: drillster/drone-volume-cache + volumes: + - name: cache + path: /cache + settings: + rebuild: true + mount: + - ./androidApp/build/outputs/apk/githubConfig/release/ + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] + +volumes: + - name: cache + host: + path: /tmp/cache +--- +kind: pipeline +type: docker name: Deploy steps: - - name: build-and-sign + - name: getNodeModules + image: drillster/drone-volume-cache + volumes: + - name: cache + path: /cache + settings: + restore: true + mount: + - ./androidApp/build/outputs/apk/githubConfig/release/ + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] + + - name: sign image: mingc/android-build-box:latest commands: - - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS - $ANDROID_HOME/build-tools/31.0.0/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk @@ -20,4 +68,8 @@ steps: trigger: branch: - - drone-sigh \ No newline at end of file + - drone-sigh +volumes: + - name: cache + host: + path: /tmp/cache \ No newline at end of file -- 2.34.1 From 82ca451f0b31fac12dacd900276c9668d501bf9a Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 21:56:24 +0200 Subject: [PATCH 08/24] Is this working ? --- .drone.yml | 60 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 57 deletions(-) diff --git a/.drone.yml b/.drone.yml index 563e6f6..cf6a04a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,60 +1,12 @@ kind: pipeline type: docker -name: android - -steps: - - name: code-analysis - image: mingc/android-build-box:latest - failure: ignore - commands: - - ls -la - - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" - environment: - SONAR_HOST_URL: - from_secret: sonarScannerHostUrl - SONAR_LOGIN: - from_secret: sonarScannerLogin - - - name: build - image: mingc/android-build-box:latest - commands: - - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - - - name: saveBuild - image: drillster/drone-volume-cache - volumes: - - name: cache - path: /cache - settings: - rebuild: true - mount: - - ./androidApp/build/outputs/apk/githubConfig/release/ - cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] - -volumes: - - name: cache - host: - path: /tmp/cache ---- -kind: pipeline -type: docker name: Deploy steps: - - name: getNodeModules - image: drillster/drone-volume-cache - volumes: - - name: cache - path: /cache - settings: - restore: true - mount: - - ./androidApp/build/outputs/apk/githubConfig/release/ - cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] - - - name: sign + - name: build-and-sign image: mingc/android-build-box:latest commands: + - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS - $ANDROID_HOME/build-tools/31.0.0/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk @@ -64,12 +16,6 @@ steps: from_secret: keyPass YOUR_KEY_ALIAS: from_secret: keyAlias - - trigger: branch: - - drone-sigh -volumes: - - name: cache - host: - path: /tmp/cache \ No newline at end of file + - drone-sigh \ No newline at end of file -- 2.34.1 From 44b70263985cca9e7db316682dce491f6ab63aa1 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 22:11:35 +0200 Subject: [PATCH 09/24] Still testing --- .drone.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index cf6a04a..85064a2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,19 +3,22 @@ type: docker name: Deploy steps: + - name: build-and-sign image: mingc/android-build-box:latest commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./key -storepass $YOUR_KEYSTORE_PASSWORD androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk $YOUR_KEY_ALIAS - - $ANDROID_HOME/build-tools/31.0.0/zipalign -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk - - $ANDROID_HOME/build-tools/31.0.0/apksigner verify androidApp/build/outputs/apk/githubConfig/release/android-prod-released-signed.apk + - $ANDROID_HOME/build-tools/31.0.0/zipalign -f -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk + - $ANDROID_HOME/build-tools/31.0.0/apksigner sign -v --out signed.apk --ks ./key --ks-key-alias $YOUR_KEY_ALIAS --ks-pass $YOUR_KEYSTORE_PASSWORD --v1-signing-enabled true --v2-signing-enabled true androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk + - $ANDROID_HOME/build-tools/31.0.0/apksigner verify signed.apk environment: YOUR_KEYSTORE_PASSWORD: from_secret: keyPass YOUR_KEY_ALIAS: from_secret: keyAlias -trigger: - branch: - - drone-sigh \ No newline at end of file + +volumes: + - name: cache + host: + path: /tmp/cache \ No newline at end of file -- 2.34.1 From e121e557710a2578209a4aec3403d9435063ae20 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 22:20:10 +0200 Subject: [PATCH 10/24] Should fix issue. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 85064a2..f4ec65d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,7 +10,7 @@ steps: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - wget https://amine-louveau.fr/key - $ANDROID_HOME/build-tools/31.0.0/zipalign -f -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk - - $ANDROID_HOME/build-tools/31.0.0/apksigner sign -v --out signed.apk --ks ./key --ks-key-alias $YOUR_KEY_ALIAS --ks-pass $YOUR_KEYSTORE_PASSWORD --v1-signing-enabled true --v2-signing-enabled true androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk + - $ANDROID_HOME/build-tools/31.0.0/apksigner sign -v --out signed.apk --ks ./key --ks-key-alias $YOUR_KEY_ALIAS --ks-pass pass:$YOUR_KEYSTORE_PASSWORD --v1-signing-enabled true --v2-signing-enabled true androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk - $ANDROID_HOME/build-tools/31.0.0/apksigner verify signed.apk environment: YOUR_KEYSTORE_PASSWORD: -- 2.34.1 From 5d9c887e6359ba9a5e4cf812ff597ed693c35900 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 06:53:37 +0200 Subject: [PATCH 11/24] Workflow --- .drone.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index f4ec65d..fbca5e5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,13 +1,55 @@ kind: pipeline type: docker -name: Deploy +name: test steps: + - name: code-analysis + image: mingc/android-build-box:latest + failure: ignore + commands: + - ls -la + - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" + environment: + SONAR_HOST_URL: + from_secret: sonarScannerHostUrl + SONAR_LOGIN: + from_secret: sonarScannerLogin - - name: build-and-sign + - name: generateApk + image: mingc/android-build-box:latest + commands: + - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + +--- +kind: pipeline +type: docker +name: Publish + +steps: + - name: createTag + commands: + - ./build.sh + +trigger: + event: + - promote + target: + - production + +--- +kind: pipeline +type: docker +name: Release + +steps: + - name: build image: mingc/android-build-box:latest commands: - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + + - name: sign + image: mingc/android-build-box:latest + commands: - wget https://amine-louveau.fr/key - $ANDROID_HOME/build-tools/31.0.0/zipalign -f -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk - $ANDROID_HOME/build-tools/31.0.0/apksigner sign -v --out signed.apk --ks ./key --ks-key-alias $YOUR_KEY_ALIAS --ks-pass pass:$YOUR_KEYSTORE_PASSWORD --v1-signing-enabled true --v2-signing-enabled true androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk @@ -18,7 +60,13 @@ steps: YOUR_KEY_ALIAS: from_secret: keyAlias -volumes: - - name: cache - host: - path: /tmp/cache \ No newline at end of file + - name: gitea_release + image: plugins/gitea-release + settings: + api_key: + from_secret: giteaAPI + base_url: https://gitea.amine-louveau.fr + files: signed.apk +trigger: + event: + - tag \ No newline at end of file -- 2.34.1 From b1d056d2a16010c90847fa84d20f5f55d5ca3558 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 08:49:42 +0200 Subject: [PATCH 12/24] Fixes. --- .drone.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fbca5e5..fdd434e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,10 +15,14 @@ steps: SONAR_LOGIN: from_secret: sonarScannerLogin - - name: generateApk + - name: build image: mingc/android-build-box:latest commands: - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false +trigger: + event: + - push + - pull_request --- kind: pipeline @@ -27,6 +31,7 @@ name: Publish steps: - name: createTag + image: ubuntu:latest commands: - ./build.sh -- 2.34.1 From 3e47c6737ebef7124c8515015ea6ef62eb152ff4 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:17:19 +0200 Subject: [PATCH 13/24] Fixes. --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index fdd434e..497142a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,6 +33,7 @@ steps: - name: createTag image: ubuntu:latest commands: + - apt-get update && apt-get install -y git - ./build.sh trigger: -- 2.34.1 From 99322a05515d80d1978761d962b739493add8d5e Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:24:43 +0200 Subject: [PATCH 14/24] SCP from ci. --- .drone.yml | 2 +- build.sh | 2 +- publish-version.sh | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 497142a..3cea822 100644 --- a/.drone.yml +++ b/.drone.yml @@ -34,7 +34,7 @@ steps: image: ubuntu:latest commands: - apt-get update && apt-get install -y git - - ./build.sh + - ./build.sh --publish --from-ci trigger: event: diff --git a/build.sh b/build.sh index a8bcc27..a5e7138 100755 --- a/build.sh +++ b/build.sh @@ -25,7 +25,7 @@ PARAMS_EXCEPT_PUBLISH=$(echo $1 | sed 's/\-\-publish//') if [[ "$@" == *'--publish'* ]] then - ./publish-version.sh ${VERSION} + ./publish-version.sh ${VERSION} $@ else echo "Did not publish. If you wanted to do so, call the script with \"--publish\" or \"--publish-local\"." fi diff --git a/publish-version.sh b/publish-version.sh index 4d4c5b9..38ed8a6 100755 --- a/publish-version.sh +++ b/publish-version.sh @@ -5,7 +5,11 @@ rm -f version.txt printf "versionName=$1-github\nversionCode=$1" >> version.txt -# You'll need to change server as your server and define a VERSION_PATH. -scp version.txt server:$VERSION_PATH - -rm version.txt +if [[ "$@" == *'--from-ci'* ]] +then + echo "File created. HANDLE IN CI" +else + # You'll need to change server as your server and define a VERSION_PATH. + scp version.txt server:$VERSION_PATH + rm version.txt +fi -- 2.34.1 From 8efe1267979b7464d6f7c95daf2a04a16affb0cf Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:25:59 +0200 Subject: [PATCH 15/24] For testing. --- .drone.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3cea822..53719ce 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,22 +3,10 @@ type: docker name: test steps: - - name: code-analysis - image: mingc/android-build-box:latest - failure: ignore + - name: createTag + image: ubuntu:latest commands: - - ls -la - - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" - environment: - SONAR_HOST_URL: - from_secret: sonarScannerHostUrl - SONAR_LOGIN: - from_secret: sonarScannerLogin - - - name: build - image: mingc/android-build-box:latest - commands: - - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + - echo "toto" trigger: event: - push -- 2.34.1 From 7899fc41273c4a3404ae134a8eef3d3266ea3ea3 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:38:03 +0200 Subject: [PATCH 16/24] Push. --- .drone.yml | 19 +++++++++++++++++++ build.sh | 2 +- version.sh | 12 ++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 53719ce..432acc9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,6 +24,25 @@ steps: - apt-get update && apt-get install -y git - ./build.sh --publish --from-ci + - name: git-push + image: appleboy/drone-git-push + settings: + remote: root@aminecmi+giteaadmin@pm.me:Louvorg/ReaderForSelfoss-multiplatform.git + followtags: true + ssh_key: + from_secret: giteaKey + + - name: scpFiles + image: appleboy/drone-scp + settings: + host: amine-louveau.fr + username: ubuntu + key: + from_secret: privateKey + port: 22 + target: /home/ubuntu/ + source: version.txt + trigger: event: - promote diff --git a/build.sh b/build.sh index a5e7138..c68baad 100755 --- a/build.sh +++ b/build.sh @@ -21,7 +21,7 @@ VERSION="${INITIAL_VERSION}${TODAYS_VERSION}" PARAMS_EXCEPT_PUBLISH=$(echo $1 | sed 's/\-\-publish//') -./version.sh ${VERSION} ${PARAMS_EXCEPT_PUBLISH} +./version.sh ${VERSION} ${PARAMS_EXCEPT_PUBLISH} $@ if [[ "$@" == *'--publish'* ]] then diff --git a/version.sh b/version.sh index 3bb4033..67afe93 100755 --- a/version.sh +++ b/version.sh @@ -4,8 +4,12 @@ echo "Creating tag $@" TAG="v$@" -git tag ${TAG} +git tag -a ${TAG} -echo "Pushing tag" - -git push origin ${TAG} +if [[ "$@" == *'--from-ci'* ]] +then + echo "Tag created. HANDLE IN CI" +else + echo "Pushing tag" + git push origin ${TAG} +fi -- 2.34.1 From bdc39c59264cffa637f9b77b49cc2e833ac18cf2 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:49:12 +0200 Subject: [PATCH 17/24] Is this the right url ? --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 432acc9..6e4fdfb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,7 @@ steps: - name: git-push image: appleboy/drone-git-push settings: - remote: root@aminecmi+giteaadmin@pm.me:Louvorg/ReaderForSelfoss-multiplatform.git + remote: git@gitea.amine-louveau.fr:Louvorg/ReaderForSelfoss-multiplatform.git followtags: true ssh_key: from_secret: giteaKey -- 2.34.1 From 2a9b31222bb0777cc01d229e4714eab8bc0e5d23 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:52:55 +0200 Subject: [PATCH 18/24] Fix version. --- version.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/version.sh b/version.sh index 67afe93..41413ff 100755 --- a/version.sh +++ b/version.sh @@ -1,9 +1,8 @@ #!/bin/bash -# You can pass --force as first parameter to force push and tag creation. -echo "Creating tag $@" +echo "Creating tag $1" -TAG="v$@" +TAG="v$1" git tag -a ${TAG} if [[ "$@" == *'--from-ci'* ]] -- 2.34.1 From 1d140932449af77df774519f8dc83a9716eac5b6 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 10:57:05 +0200 Subject: [PATCH 19/24] truc. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6e4fdfb..b3398b9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,7 @@ steps: - name: git-push image: appleboy/drone-git-push settings: - remote: git@gitea.amine-louveau.fr:Louvorg/ReaderForSelfoss-multiplatform.git + remote: ssh://git@gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform.git followtags: true ssh_key: from_secret: giteaKey -- 2.34.1 From cdaba0e77c43e365caa564323b4f98f5d1d9f032 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 11:45:51 +0200 Subject: [PATCH 20/24] Manual git push. --- .drone.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index b3398b9..54b391e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,14 +23,13 @@ steps: commands: - apt-get update && apt-get install -y git - ./build.sh --publish --from-ci - - - name: git-push - image: appleboy/drone-git-push - settings: - remote: ssh://git@gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform.git - followtags: true - ssh_key: - from_secret: giteaKey + - git remote add pushing https://$GITEA_USR:$GITEA_PASS@gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform.git + - git push pushing ${TAG} + environment: + GITEA_USR: + from_secret: giteaUsr + GITEA_PASS: + from_secret: giteaPass - name: scpFiles image: appleboy/drone-scp -- 2.34.1 From 065b59eb7b102b0429d1910e64d60863986f1ac3 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 11:50:08 +0200 Subject: [PATCH 21/24] Tag. --- version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.sh b/version.sh index 41413ff..afb679a 100755 --- a/version.sh +++ b/version.sh @@ -3,7 +3,7 @@ echo "Creating tag $1" TAG="v$1" -git tag -a ${TAG} +git tag -a ${TAG} -m ${TAG} if [[ "$@" == *'--from-ci'* ]] then -- 2.34.1 From d1d0bbf4a31879ec97d2db64200d12007e54f3c5 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 11:52:57 +0200 Subject: [PATCH 22/24] Tags. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 54b391e..66664ca 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,7 +24,7 @@ steps: - apt-get update && apt-get install -y git - ./build.sh --publish --from-ci - git remote add pushing https://$GITEA_USR:$GITEA_PASS@gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform.git - - git push pushing ${TAG} + - git push pushing --tags environment: GITEA_USR: from_secret: giteaUsr -- 2.34.1 From f82920efe274026d73359e364e4a0d8f6ec4777c Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 11:58:38 +0200 Subject: [PATCH 23/24] Should be ok. --- .drone.yml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 66664ca..3de36e6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,10 +3,22 @@ type: docker name: test steps: - - name: createTag - image: ubuntu:latest + - name: code-analysis + image: mingc/android-build-box:latest + failure: ignore commands: - - echo "toto" + - ls -la + - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" + environment: + SONAR_HOST_URL: + from_secret: sonarScannerHostUrl + SONAR_LOGIN: + from_secret: sonarScannerLogin + + - name: build + image: mingc/android-build-box:latest + commands: + - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false trigger: event: - push @@ -42,6 +54,20 @@ steps: target: /home/ubuntu/ source: version.txt + - name: deploy + image: appleboy/drone-ssh + settings: + host: amine-louveau.fr + user: ubuntu + key: + from_secret: privateKey + command_timeout: 2m + script: + - cd /home/ubuntu + - sudo rm -rf /var/www/amine/version.txt + - sudo chown www-data:www-data ./version.txt + - sudo mv version.txt /var/www/amine/ + trigger: event: - promote -- 2.34.1 From 26ed0fbb3220ec5e2890846d5ffc68a55023fc7e Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 14 Sep 2022 12:09:21 +0200 Subject: [PATCH 24/24] Things should be quicker. --- .drone.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3de36e6..2703761 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,22 +3,24 @@ type: docker name: test steps: - - name: code-analysis + - name: AnylyseBuildTest image: mingc/android-build-box:latest failure: ignore commands: - - ls -la + - echo "---------------------------------------------------------" + - echo "Analysing..." - ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" + - echo "---------------------------------------------------------" + - echo "Building..." + - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false + - echo "---------------------------------------------------------" + - echo "Testing..." + - echo "---------------------------------------------------------" environment: SONAR_HOST_URL: from_secret: sonarScannerHostUrl SONAR_LOGIN: from_secret: sonarScannerLogin - - - name: build - image: mingc/android-build-box:latest - commands: - - ./gradlew :androidApp:build -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false trigger: event: - push @@ -83,14 +85,19 @@ steps: - name: build image: mingc/android-build-box:latest commands: + - echo "Generate APK" - ./gradlew :androidApp:assembleGithubConfigRelease -PignoreGitVersion=true -P appLoginUrl="\"URL\"" -P appLoginUsername="\"LOGIN\"" -P appLoginPassword="\"PASS\"" -P pushCache=false - - - name: sign - image: mingc/android-build-box:latest - commands: + - echo "---------------------------------------------------------" + - echo "Get Key" - wget https://amine-louveau.fr/key + - echo "---------------------------------------------------------" + - echo "Zipalign" - $ANDROID_HOME/build-tools/31.0.0/zipalign -f -v 4 androidApp/build/outputs/apk/githubConfig/release/androidApp-githubConfig-release-unsigned.apk androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk + - echo "---------------------------------------------------------" + - echo "Sign" - $ANDROID_HOME/build-tools/31.0.0/apksigner sign -v --out signed.apk --ks ./key --ks-key-alias $YOUR_KEY_ALIAS --ks-pass pass:$YOUR_KEYSTORE_PASSWORD --v1-signing-enabled true --v2-signing-enabled true androidApp/build/outputs/apk/githubConfig/release/android-prod-released-ziped.apk + - echo "---------------------------------------------------------" + - echo "Verify" - $ANDROID_HOME/build-tools/31.0.0/apksigner verify signed.apk environment: YOUR_KEYSTORE_PASSWORD: -- 2.34.1