Skip to content

Merge "Add a recipe to show how to add a generated dir to a MultipleA… #3

Merge "Add a recipe to show how to add a generated dir to a MultipleA…

Merge "Add a recipe to show how to add a generated dir to a MultipleA… #3

name: Convert recipes flow
on:
push:
workflow_dispatch:
jobs:
build-gradle-project:
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v3
with:
path: main
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Initialize mandatory git config
run: |
cd main
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Checkout and run build converter tool
run: |
ls
cd main
git fetch --all --depth=1
cd convert-tool
./gradlew standaloneJar
echo "Built converter"
cd ..
- name: Convert recipes
run: |
cd main
grep -v "^#" version_mappings.txt | while read line
do
versions=(${line//;/ })
AGP=${versions[0]}
GRADLE=${versions[1]}
echo "Converting for AGP $AGP with Gradle $GRADLE"
BRANCH="test-agp-"
BRANCH+=${AGP:0:3}
BRANCH_DIR="../$BRANCH"
echo "Working on branch $BRANCH in $BRANCH_DIR"
mkdir $BRANCH_DIR
cp -r .git "$BRANCH_DIR/.git"
java -jar convert-tool/app/build/libs/recipes-converter-all.jar \
--action convert --sourceAll recipes \
--destination "$BRANCH_DIR" \
--agpVersion "$AGP" --gradleVersion "$GRADLE" --overwrite
echo "Converted recipes"
cd $BRANCH_DIR
find . -name gradlew | xargs chmod +x
git branch $BRANCH origin/${GITHUB_REF##*/} || git branch $BRANCH
git reset $BRANCH
git checkout $BRANCH
git add -A
echo "Ready for commit"
git commit --message "Prepare release" || echo "Nothing to commit"
git push -f --set-upstream origin $BRANCH
echo "Done for $BRANCH"
cd ../main
done
cd ..