Skip to content

Commit

Permalink
Prepare for 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
siavash79 committed Dec 12, 2022
1 parent ef0c2d6 commit 815395b
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 19 deletions.
51 changes: 36 additions & 15 deletions .github/bumpVersion.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
#!/bin/bash

NEWVERCODE=$(($(cat app/build.gradle | grep versionCode | tr -s ' ' | cut -d " " -f 2 | tr -d '\r')+1))
NEWVERNAME="canary-$NEWVERCODE"
NEWVERNAME=${GITHUB_REF_NAME/v/}

#Prepare gradle script for build
sed -i 's/versionCode.*/versionCode '$NEWVERCODE'/' app/build.gradle
sed -i 's/versionName.*/versionName "'$NEWVERNAME'"/' app/build.gradle

#prepare magisk module props
#Xposed
sed -i 's/version=.*/version='$NEWVERNAME'/' MagiskModBase/module.prop
sed -i 's/versionCode=.*/versionCode='$NEWVERCODE'/' MagiskModBase/module.prop
#Full
sed -i 's/version=.*/version='$NEWVERNAME'/' MagiskModAddon/module.prop
sed -i 's/versionCode=.*/versionCode='$NEWVERCODE'/' MagiskModAddon/module.prop

sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' latestVersion.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' latestVersion.json
sed -i 's/"zipUrl":.*/"zipUrl": "https:\/\/nightly.link\/siavash79\/AOSPMods\/actions\/runs\/'$1'\/AOSPMods_Full.zip",/' latestVersion.json

sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' latestCanary.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' latestCanary.json
sed -i 's/"zipUrl_Xposed":.*/"zipUrl_Xposed": "https:\/\/nightly.link\/siavash79\/AOSPMods\/actions\/runs\/'$1'\/AOSPMods_Xposed.zip",/' latestCanary.json
sed -i 's/"zipUrl_Full":.*/"zipUrl_Full": "https:\/\/nightly.link\/siavash79\/AOSPMods\/actions\/runs\/'$1'\/AOSPMods_Full.zip",/' latestCanary.json
sed -i 's/"zipUrl":.*/"zipUrl": "https:\/\/nightly.link\/siavash79\/AOSPMods\/actions\/runs\/'$1'\/AOSPMods_Full.zip",/' latestCanary.json
#Prepare magisk module update files of legacy, full and xposed types
#legacy
sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' MagiskModuleUpdate.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' MagiskModuleUpdate.json
sed -i 's/"zipUrl":.*/"zipUrl": "https:\/\/github.com\/siavash79\/AOSPMods\/releases\/download\/'$GITHUB_REF_NAME'\/AOSPMods_Full.zip",/' MagiskModuleUpdate.json
#Full
sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' MagiskModuleUpdate_Full.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' MagiskModuleUpdate_Full.json
sed -i 's/"zipUrl":.*/"zipUrl": "https:\/\/github.com\/siavash79\/AOSPMods\/releases\/download\/'$GITHUB_REF_NAME'\/AOSPMods_Full.zip",/' MagiskModuleUpdate_Full.json
#Xposed
sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' MagiskModuleUpdate_Xposed.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' MagiskModuleUpdate_Xposed.json
sed -i 's/"zipUrl":.*/"zipUrl": "https:\/\/github.com\/siavash79\/AOSPMods\/releases\/download\/'$GITHUB_REF_NAME'\/AOSPMods_Xposed.zip",/' MagiskModuleUpdate_Xposed.json
#In-app updater
sed -i 's/"version":.*/"version": "'$NEWVERNAME'",/' latestStable.json
sed -i 's/"versionCode":.*/"versionCode": '$NEWVERCODE',/' latestStable.json
sed -i 's/"zipUrl_Full":.*/"zipUrl_Full": "https:\/\/github.com\/siavash79\/AOSPMods\/releases\/download\/'$GITHUB_REF_NAME'\/AOSPMods_Full.zip",/' latestStable.json
sed -i 's/"zipUrl_Xposed":.*/"zipUrl_Xposed": "https:\/\/github.com\/siavash79\/AOSPMods\/releases\/download\/'$GITHUB_REF_NAME'\/AOSPMods_Xposed.zip"/' latestStable.json

# module changelog
echo "**$NEWVERNAME** " > newChangeLog.md
cat changeLog.md >> newChangeLog.md
cat .github/workflowFiles/FutureChanageLog.md >> newChangeLog.md
echo " " >> newChangeLog.md
cat CanaryChangelog.md >> newChangeLog.md
mv newChangeLog.md CanaryChangelog.md
cat MagiskChangelog.md >> newChangeLog.md
mv newChangeLog.md MagiskChangelog.md

# release notes
echo "**Changelog:** " > releaseNotes.md
cat .github/workflowFiles/FutureChanageLog.md >> releaseNotes.md
cat .github/workflowFiles/ReleaseNotesTemplate.md >> releaseNotes.md

echo "*$NEWVERNAME* released in canary channel " > telegram.msg
echo "*$NEWVERNAME* released in stable channel " > telegram.msg
echo " " >> telegram.msg
echo "*Changelog:* " >> telegram.msg
cat changeLog.md >> telegram.msg
cat .github/workflowFiles/FutureChanageLog.md >> telegram.msg
echo 'TMessage<<EOF' >> $GITHUB_ENV
cat telegram.msg >> $GITHUB_ENV
echo >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
16 changes: 12 additions & 4 deletions .github/make_zip.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#!/bin/bash

mkdir -p output/full output/xposed
mkdir -p output
cp app/build/outputs/apk/release/AOSPMods-signed.apk MagiskModBase/system/priv-app/AOSPMods/AOSPMods.apk
cd MagiskModBase;
LITE_FILENAME="AOSPMods_Xposed.zip"
FULL_FILENAME="AOSPMods_Full.zip"

echo 1 > build.type
zip -r ../output/xposed/$LITE_FILENAME *;
zip -r ../output/$LITE_FILENAME *;

cp -r ../MagiskModAddon/* ./
#we'll need this file to return safely
mkdir ../tmp
mv module.prop ../tmp/module.prop

cp -rf ../MagiskModAddon/* ./
echo 0 > build.type

zip -r ../output/full/$FULL_FILENAME *;
zip -r ../output/$FULL_FILENAME *;

#bring xposed mod prop back for commit
rm -rf module.prop
mv ../tmp/module.prop module.prop
85 changes: 85 additions & 0 deletions .github/workflows/makeBranchRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Make Release

on:
push:
branches: 'v2.4.x'
tags: '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Grab Source
run: git clone --branch v2.4.x --single-branch --recurse-submodules https://github.com/siavash79/AOSPMods.git .

- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant permission shell scripts
run: chmod +x .github/*.sh

- name: Update Versions
run: .github/bumpVersion.sh

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew assembleRelease

- uses: r0adkll/sign-android-release@v1
name: Sign app APK
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "33.0.0"

- name: Run the zip script
run: .github/make_zip.sh

- name: Upload Zip
uses: actions/upload-artifact@v2
with:
name: AOSPMods.zip
path: output

- name: Release the binaries
uses: Hs1r1us/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: 'releaseNotes.md'
prerelease: false
draft: true
asset_files: 'output'

- name: Commit version bump
uses: github-actions-x/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'stable'
commit-message: 'Version update: Release'
force-add: 'true'
files: MagiskModBase/module.prop MagiskModAddon/module.prop app/build.gradle
name: GitHub
email: [email protected]

- name: Inform Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.AOSPMODS_CHANNEL_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: ${{ env.TMessage }}
format: markdown

0 comments on commit 815395b

Please sign in to comment.