Skip to content

修复1个图标,更新1个图标 #455

修复1个图标,更新1个图标

修复1个图标,更新1个图标 #455

Workflow file for this run

name: Update MIUI Res
on:
push:
paths:
- 'icons/**'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update Icons
run: |
git config --global user.email sdustpedro@gmail.com
git config --global user.name pedroz
sha=$(git rev-parse --short HEAD)
commit_msg="Deploy ${sha}"
mkdir -p /tmp/git_push
cp -a -r icons/* /tmp/git_push
cd /tmp/git_push
remote_repo="https://${{ secrets.GIT_USERS }}:${{ secrets.GIT_TOKEN }}@e.coding.net/miuiicons/icons/icons2.git"
git clone --depth 1 $remote_repo /tmp/dest
rm -rf /tmp/git_push/.git
cp -r /tmp/dest/.git/ /tmp/git_push/.git/
git add .
git commit -m "${commit_msg}" || true
git push || true
git_SHA=$(git rev-parse --short HEAD)
cd ${GITHUB_WORKSPACE}
mkdir -p temp/res/
cp -rf /tmp/git_push ./temp/res/drawable-xxhdpi/
cd temp
zip -r -9 icons.zip * >/dev/null
mv icons.zip icons
XZ_OPT=-9 tar cJf iconsrepo.tar.xz icons
cd ${GITHUB_WORKSPACE}/temp/res/drawable-xxhdpi/
echo $(ls -l | grep "^d" | wc -l) > ${GITHUB_WORKSPACE}/temp/iconscount.txt
cd ${GITHUB_WORKSPACE}/temp/
:> iconsrepo.ini
echo "file_size=`ls -l ./iconsrepo.tar.xz | awk '{print $5}'`" >> ./iconsrepo.ini
echo "md5=`md5sum ./iconsrepo.tar.xz|cut -d ' ' -f1`" >> ./iconsrepo.ini
echo "theme_name=主图标仓库" >> ./iconsrepo.ini
echo "theme_version=$(TZ=':Asia/Shanghai' date '+%Y%m%d%H%M')" >> ./iconsrepo.ini
echo "git_SHA=$git_SHA" >> ./iconsrepo.ini
#curl -T iconsrepo.tar.xz -u ${{secrets.coding_password}} "https://miuiicons-generic.pkg.coding.net/icons/hyper/iconsrepo.tar.xz?version=latest"
curl -T iconsrepo.ini -u ${{secrets.coding_password}} "https://miuiicons-generic.pkg.coding.net/icons/hyper/iconsrepo.ini?version=latest"
curl -T iconscount.txt -u ${{secrets.coding_password}} "https://miuiicons-generic.pkg.coding.net/icons/hyper/iconscount.txt?version=latest"
curl https://rclone.org/install.sh | sudo bash
mkdir -p ~/.config/rclone/
echo ${{ secrets.DBBASE64 }} > base64.txt
base64 --decode base64.txt > ~/.config/rclone/rclone.conf
rclone copy -P iconsrepo.tar.xz onedrive:/icons/hyper
- name: Get Env
run: |
echo time=$(TZ=':Asia/Shanghai' date '+%Y.%m.%d %H:%M') >> $GITHUB_ENV
echo "${{ github.event.head_commit.message }}" > 1.txt
echo changelog=$(awk '{printf " %s\\n \\n ", $0}' 1.txt) >> $GITHUB_ENV
- name: Push changelog
run: |
curl -i -X POST -H 'Content-type':'application/json' -d '{"token":"${{secrets.push_token}}","title":"完美图标更新通知","content":" **完美图标更新了** \n \n **更新时间:${{ env.time }}** \n \n **更新内容** \n \n ``` \n \n ${{ github.event.head_commit.message }} \n \n ``` \n \n by ` ${{ github.event.head_commit.author.name }} ` \n \n [查看详细更新内容](${{ github.event.head_commit.url }}) \n \n 可前往完美图标计划APP进行更新或下载。 ","topic":"MIUI","template":"markdown"}' http://www.pushplus.plus/send
curl -i -X POST -H 'Content-type':'application/json' -d '{"appToken":"${{secrets.push_token2}}","summary":"完美图标更新通知","content":" **完美图标更新了** \n \n **更新时间:${{ env.time }}** \n \n **更新内容** \n \n ``` \n \n ${{ env.changelog }} ``` \n \n by ` ${{ github.event.head_commit.author.name }} ` \n \n [查看详细更新内容](${{ github.event.head_commit.url }}) \n \n 可前往完美图标计划APP进行更新或下载。 ","topicIds":[4163],"contentType":3}' http://wxpusher.zjiecode.com/api/send/message
- name: Update changelog
run: |
curl -skLJo old.xml https://miuiicons-generic.pkg.coding.net/icons/files/changelog2.xml?version=latest
time=$(TZ=':Asia/Shanghai' date '+%Y.%m.%d %H:%M')
:>new.xml
cat >> new.xml << \EOF
<group>
<text>
<title>${{ env.time }}</title>
<desc>${{ github.event.head_commit.message }}
by ${{ github.event.head_commit.author.name }}</desc>
<slice break="break" link="${{ github.event.head_commit.url }}" underline="underline"> 轻触查看详细内容>> </slice>
</text>
</group>
EOF
:>output.xml
cat new.xml old.xml > output.xml
curl -T output.xml -u ${{secrets.coding_password}} "https://miuiicons-generic.pkg.coding.net/icons/files/changelog2.xml?version=latest"