Skip to content

Instantly share code, notes, and snippets.

View BelooS's full-sized avatar
:electron:

Oleg Beloy BelooS

:electron:
  • Pango
  • Ukraine, Portugal
View GitHub Profile
@BelooS
BelooS / build.gradle
Created October 30, 2020 11:23
resolveDependencies
task resolveDependencies {
description "Resolves all projects dependencies from the repository."
group "Build Server"
doLast {
rootProject.allprojects { project ->
project.buildscript.configurations.forEach { configuration ->
if (configuration.canBeResolved) {
configuration.resolve()
}
@BelooS
BelooS / check_branch_name.sh
Created October 30, 2020 16:37
Check branch name
BRANCH_NAME="$1"
PATTERN="^feature\/[A-Z]{2,4}\-[0-9]{1,5}\-.*|^bugfix\/[A-Z]{2,4}\-[0-9]{1,5}\-.*|^release\/.*-v[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$|^junk\/.*|^revert.*|^master$"
if ! [[ $BRANCH_NAME =~ $PATTERN ]]; then
echo "Invalid branch name $BRANCH_NAME"
exit 1
fi
@BelooS
BelooS / persist_apks.sh
Created October 30, 2020 17:20
Persist apk artefacts
set -eo pipefail
APK_TARGET_DIR=~/workspace/build/circleci/apk
TEST_APK_TARGET_DIR=~/workspace/build/circleci/android-test
mkdir -p $APK_TARGET_DIR
mkdir -p $TEST_APK_TARGET_DIR
find . -type f -name "*.aab" -exec cp {} $APK_TARGET_DIR \;
find . -type f -name "*qa.apk" -exec cp {} $APK_TARGET_DIR \;
@BelooS
BelooS / extract_manifest.sh
Last active October 14, 2022 21:59
persist manifest
#!/bin/bash
set -eo pipefail
#extract_manifest.sh {TARGET_APP_NAME} {BUILD_TYPE}
#launch example: ./ci/extract_manifest.sh app debug
TARGET_APP_NAME=$1
BUILD_TYPE=$2
echo "extract manifest for $TARGET_APP_NAME"
build_dir="$WORKSPACE/$TARGET_APP_NAME/build"
@BelooS
BelooS / extract_mapping.gradle
Created November 1, 2020 12:18
Extract mapping gradle task
def extractMapping = tasks.create("extractMapping") {
description "Copy mapping archive into outputs/artifacts folder."
group 'circleci'
}
android.applicationVariants.all { variant ->
if (variant.mappingFile != null) {
def copyMapping = tasks.create(name: "copy${variant.name}Mapping", type: Copy) {
from variant.mappingFile
rename { "${archivesBaseName}-${variant.name}Mapping.txt" }
@BelooS
BelooS / clone_wiki
Last active October 14, 2022 21:11
Clone wiki step of circle ci
git clone "git@github.com:$GITHUB_PROJECT_USERNAME/$GITHUB_PROJECT_NAME.wiki.git" $WIKI_DIR
@BelooS
BelooS / push_wiki_changes
Last active October 14, 2022 19:21
Push wiki changes
cd $WIKI_DIR || exit 1
./push_changes_from_directory.sh
@BelooS
BelooS / push_changes_from_directory.sh
Last active October 14, 2022 19:51
Push changes from directory
#!/bin/bash
set -euxo pipefail
#to use this script first cd to the target directory with changes
GIT_BRANCH="$1"
echo "current dir = $PWD, git branch = $GIT_BRANCH"
git config user.email "$GIT_USER_EMAIL"
git config user.name "$GIT_USER_NAME"
git stash clear
@BelooS
BelooS / sort_manifest.py
Last active October 15, 2022 19:48
Clone & sort merged manifest
import os
import subprocess
import xml.etree.ElementTree as Tree
from xml.etree.ElementTree import Element
for var in ["TARGET_MANIFEST_PATH", "SORTED_MANIFEST_PATH"]:
if var not in os.environ:
raise EnvironmentError("Required env variable {} is not set.".format(var))
TARGET_MANIFEST_PATH = os.getenv('TARGET_MANIFEST_PATH')
#!/bin/bash
BUILD_TYPE=$1
manifest_diff_file="/manifest.diff"
usage() {
echo "Find a diff between baseline and a current manifest. Then post it to github"
echo "Usage:"
echo " post_manifest_diff.sh {BUILD_TYPE}"
echo " Example: post_manifest_diff.sh release"