Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
o0HalfLife0o committed Oct 13, 2022
1 parent b17ab9e commit 83a1255
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
58 changes: 28 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ jobs:
cd TVBoxOSC
git checkout ${{ env.commit }}
echo "tag=$(git log --date=format:'%Y%m%d-%H%M' --pretty=format:%cd ${{ env.commitS }} -1)" >> $GITHUB_ENV
zip -q -x ".git/*" -r ${{ env.commitS }}-source.zip .
- uses: actions/cache@v3
if: ${{ env.commit }}
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.userName }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.userName }}-
zip -q -x ".git/*" -r source-${{ env.commitS }}.zip .
- name: Extra Modify
if: ${{ env.commit }}
working-directory: TVBoxOSC
Expand Down Expand Up @@ -96,6 +87,9 @@ jobs:
sed -i '$a\RELEASE_KEY_ALIAS=TVBoxOSC' ./gradle.properties
sed -i '$a\RELEASE_STORE_PASSWORD=TVBoxOSC' ./gradle.properties
sed -i '$a\RELEASE_KEY_PASSWORD=TVBoxOSC' ./gradle.properties
- name: Setup Gradle
if: ${{ env.commit }}
uses: gradle/gradle-build-action@v2
- name: Build With Gradle
if: ${{ env.commit }}
working-directory: TVBoxOSC
Expand All @@ -111,6 +105,18 @@ jobs:
for file in `find ~ -name "*release*.apk" -print`; do
mv "$file" apk/TVBox_${{ matrix.userName }}_${{ env.tag }}.apk
done
- name: Release Note
if: ${{ env.commit }}
working-directory: TVBoxOSC
run: |
lastCommit=$(grep "${{ matrix.userName }}\/${{ matrix.repoName }}" ${{ github.workspace }}/README.md |grep -o '[a-z0-9]\{40\}')
export LESSCHARSET=utf-8
echo -e "Credit: ${{ matrix.userName }}/${{ matrix.repoName }}\nCommit: ${{ env.commit }}\nChangelog:" > apk/${{ matrix.userName }}-Release.log
if [ "${{ env.commit }}" == "${lastCommit}" ]; then
git log --pretty=format:%B ${{ env.commitS }} -1 |sed -e "s# \{2,\}#\n#g" -e "/^Merge \(pull\|branch\|remote\)/d" -e '/^$/d' |cat -n |sort -k2,2 -k1,1n |uniq -f1 |sort -k1,1n |cut -f2- >> apk/${{ matrix.userName }}-Release.log
else
git log --pretty=format:%B ${{ env.commitS }}...${lastCommit:0:7} |sed -e "s# \{2,\}#\n#g" -e "/^Merge \(pull\|branch\|remote\)/d" -e '/^$/d' |cat -n |sort -k2,2 -k1,1n |uniq -f1 |sort -k1,1n |cut -f2- >> apk/${{ matrix.userName }}-Release.log
fi
- name: Upload App To Artifact
uses: actions/upload-artifact@v3
if: ${{ env.commit }}
Expand All @@ -127,42 +133,34 @@ jobs:
with:
name: ${{ env.tag }}
tag_name: ${{ env.tag }}
body: "Credit: ${{ matrix.userName }}/${{ matrix.repoName }}\n
Commit: ${{ env.commit }}"
body_path: TVBoxOSC/apk/${{ matrix.userName }}-Release.log
files: |
TVBoxOSC/apk/*
TVBoxOSC/${{ env.commitS }}-source.zip
TVBoxOSC/apk/*.apk
TVBoxOSC/source-${{ env.commitS }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Post To Telegram
if: ${{ env.commit }}
working-directory: TVBoxOSC
run: |
if [ -n "${{ secrets.CHANNEL_ID }}" ] && [ -n "${{ secrets.BOT_TOKEN }}" ]; then
OUTPUT="${{ github.workspace }}/TVBoxOSC/apk/"
export appRelease=$(find $OUTPUT -name "*${{ matrix.userName }}*.apk")
export sourceCode="${{ github.workspace }}/TVBoxOSC/${{ env.commitS }}-source.zip"
lastCommit=$(grep "${{ matrix.userName }}\/${{ matrix.repoName }}" README.md |grep -o '[a-z0-9]\{40\}')
cd TVBoxOSC
export LESSCHARSET=utf-8
if [ "${{ env.commit }}" == "${lastCommit}" ]; then
COMMIT_MESSAGE="$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "`git log --pretty=format:%B ${{ env.commitS }} -1 |sed -e 's# \{2,\}#\n#g' -e '/^Merge pull/d' -e 's#\([&"\/]\)#\\\\\1#g' -e '/^$/d' |cat -n |sort -k2,2 -k1,1n |uniq -f1 |sort -k1,1n |cut -f2- `")"
else
COMMIT_MESSAGE="$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "`git log --pretty=format:%B ${{ env.commitS }}...${lastCommit:0:7} |sed -e 's# \{2,\}#\n#g' -e '/^Merge pull/d' -e 's#\([&"\/]\)#\\\\\1#g' -e '/^$/d' |cat -n |sort -k2,2 -k1,1n |uniq -f1 |sort -k1,1n |cut -f2- `")"
fi
if [ ${#COMMIT_MESSAGE} -gt 0 ] && [ ${#COMMIT_MESSAGE} -le 1024 ]; then
ESCAPED="$(echo $COMMIT_MESSAGE |sed 's#%[eE]2[0-9a-zA-Z%]\{6\}##g')"
else
COMMIT_URL=${{ env.upStream }}/commits/${{ matrix.branchName }}
ESCAPED="$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$COMMIT_URL")"
export sourceCode="${{ github.workspace }}/TVBoxOSC/source-${{ env.commitS }}.zip"
count=$(wc -m apk/${{ matrix.userName }}-Release.log |cut -d ' ' -f1)
echo $count
if [ ${count} -eq 0 ] && [ ${count} -gt 1024 ]; then
echo -e "Credit: ${{ matrix.userName }}/${{ matrix.repoName }}\nCommit: ${{ env.commit }}\nChangelog:\n${{ env.upStream }}/commits/${{ matrix.branchName }}" > apk/${{ matrix.userName }}-Release.log
fi
ESCAPED=`python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$(cat apk/${{ matrix.userName }}-Release.log |sed -e '1s/: \(.*\)\/.*/: #\1/' -e 's#\([&"\/]\)#\\\\\1#g')"`
#检查源码尺寸,太大则不上传
file_size=$(du -s ${sourceCode} | awk '{print $1}')
#文件最大值,1024代表1M
file_limit_size=20480
if [[ ${file_size} -lt ${file_limit_size} ]];then
curl -v "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.CHANNEL_ID }}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FappRelease%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FsourceCode%22%2C%20%22caption%22%3A%22Credit%3A%20%23${{ matrix.userName }}%20%0ACommit%3A%20${{ env.commit }}%0AChangelog%3A%0A${ESCAPED}%22%7D%5D" -F appRelease="@$appRelease" -F sourceCode="@$sourceCode"
curl -v "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.CHANNEL_ID }}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FappRelease%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FsourceCode%22%2C%20%22caption%22%3A%22${ESCAPED}%22%7D%5D" -F appRelease="@$appRelease" -F sourceCode="@$sourceCode"
else
curl -v "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.CHANNEL_ID }}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FappRelease%22%2C%20%22caption%22%3A%22Credit%3A%20%23${{ matrix.userName }}%20%0ACommit%3A%20${{ env.commit }}%0AChangelog%3A%0A${ESCAPED}%22%7D%5D" -F appRelease="@$appRelease"
curl -v "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendMediaGroup?chat_id=${{ secrets.CHANNEL_ID }}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FappRelease%22%2C%20%22caption%22%3A%22${ESCAPED}%22%7D%5D" -F appRelease="@$appRelease"
fi
fi
- name: Push to master
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
## Credits
This repo relies on the following third-party projects:
- [CatVodTVOfficial/TVBoxOSC](https://github.com/CatVodTVOfficial/TVBoxOSC)
- [q215613905/TVBoxOS](https://github.com/q215613905/TVBoxOS) (Updated: 834517de8785c003a53361a2da4909355de53689)
- [q215613905/TVBoxOS](https://github.com/q215613905/TVBoxOS) (Updated: dc61861380e45eac7ad36e2ee528941f74e25202)
- [takagen99/Box](https://github.com/takagen99/Box) (Updated: 1453829154248733154a8b994dfca1a6b20837c3)

0 comments on commit 83a1255

Please sign in to comment.