101 lines
3.5 KiB
YAML
101 lines
3.5 KiB
YAML
name: debug
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "README.md"
|
|
- "CHANGELOG.md"
|
|
branches:
|
|
- master
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4.1.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update Module.prop
|
|
run: |
|
|
sed -i "s/$(grep -oP 'version=\K[^ ]+' module.prop)/$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}')($(git log --oneline -n 1 | awk '{print $1}'))/g" module.prop
|
|
sed -i "s/versionCode=.*/versionCode=$(date +%Y%m%d)/g" module.prop
|
|
|
|
- name: Get Version
|
|
id: get_version
|
|
run: |
|
|
echo "version=$(grep -oP 'version=\K[^ ]+' module.prop)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Generate Asset
|
|
run: |
|
|
sudo mkdir -p /box_for_root
|
|
sudo cp -r --parents $(find ./ -type f ! -path './.git/*' ! -name 'CHANGELOG.md' ! -name 'update.json' ! -name 'build.sh' ! -path './.github/*' ! -path './docs/*') /box_for_root/
|
|
|
|
- name: Upload Debug Asset => (box_for_magisk_${{ steps.get_version.outputs.version }})
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: "box_for_magisk_${{ steps.get_version.outputs.version }}"
|
|
path: /box_for_root/
|
|
|
|
upload:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4.1.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check for [ci] in commit message
|
|
id: check_ci
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
echo "Last commit message: $COMMIT_MSG"
|
|
if [[ "$COMMIT_MSG" == *"[ci]"* ]]; then
|
|
echo "should_upload=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "should_upload=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Run build
|
|
if: steps.check_ci.outputs.should_upload == 'true'
|
|
run: |
|
|
sed -i "s/$(grep -oP 'version=\K[^ ]+' module.prop)/$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}')($(git log --oneline -n 1 | awk '{print $1}'))/g" module.prop
|
|
zip -r -o -X -ll box_for_root-$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}').zip ./ \
|
|
-x '.git/*' -x 'CHANGELOG.md' -x 'update.json' -x 'build.sh' -x '.github/*' -x 'docs/*'
|
|
|
|
- name: Upload to GitHub Pre-release
|
|
if: steps.check_ci.outputs.should_upload == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
VERSION=$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}')
|
|
FILE=$(find . -name "*.zip")
|
|
gh release create "pre-${VERSION}" "$FILE" \
|
|
--prerelease \
|
|
--title "Pre-release ${VERSION}" \
|
|
--notes "pre-release build from commit $(git log -1 --pretty=%h)"
|
|
|
|
- name: Upload to Telegram
|
|
if: steps.check_ci.outputs.should_upload == 'true'
|
|
env:
|
|
CHAT_ID: "-1001597117128"
|
|
MESSAGE_THREAD_ID: "282263"
|
|
API_ID: ${{ secrets.API_ID }}
|
|
API_HASH: ${{ secrets.API_HASH }}
|
|
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
run: |
|
|
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
|
export VERSION=$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}')
|
|
export COMMIT=$(git log --oneline -n 5 --no-decorate | sed 's/^[0-9a-f]* //' | sed 's/^/- /')
|
|
FILE=$(find . -name "*.zip")
|
|
pip3 install telethon==1.31.1
|
|
python3 $GITHUB_WORKSPACE/.github/taamarinbot.py "$FILE"
|
|
fi |