workflows: adjust debug #264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: debug | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "README.md" | |
- "CHANGELOG.md" | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get tags | |
id: get_tags | |
run: | | |
echo "tag=$(grep -oP 'version=\K[^ ]+' module.prop)" >> "$GITHUB_OUTPUT" | |
echo "version=$(git rev-parse --short HEAD)_$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" | |
echo "versionCode=$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" | |
- name: update module.prop | |
run: | | |
sed -i "s/${{ steps.get_tags.outputs.tag }}/&_${{ steps.get_tags.outputs.version }}_debug/g" module.prop | |
sed -i "s/versionCode=.*/versionCode=${{ steps.get_tags.outputs.versionCode }}/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@v3 | |
with: | |
name: "box_for_magisk_${{ steps.get_version.outputs.version }}" | |
path: /box_for_root/ | |
upload: | |
name: Telegram Upload Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get tags | |
id: get_tags | |
run: | | |
echo "tag=$(grep -oP 'version=\K[^ ]+' module.prop)" >> "$GITHUB_OUTPUT" | |
echo "version=$(git rev-parse --short HEAD)_$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" | |
echo "versionCode=$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" | |
- name: Get Version and Build | |
run: | | |
sed -i "s/${{ steps.get_tags.outputs.tag }}/&_${{ steps.get_tags.outputs.version }}_debug/g" module.prop | |
sed -i "s/versionCode=.*/versionCode=${{ steps.get_tags.outputs.versionCode }}/g" module.prop | |
sh build.sh | |
- name: Upload to telegram | |
env: | |
CHAT_ID: ${{ secrets.CHAT_ID }} | |
CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} | |
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
COMMIT_URL: ${{ github.event.head_commit.url }} | |
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
TITLE: box for root ${{ steps.get_tags.outputs.tag }}_${{ steps.get_tags.outputs.version }}_debug | |
run: | | |
export VERSION=${{ steps.get_tags.outputs.tag }}_${{ steps.get_tags.outputs.version }} | |
export CG=$(git log --oneline -n 5) | |
FILE=$(find ./*.zip -type f) | |
pip3 install python-telegram-bot | |
python3 docs/tubot.py $FILE |