新增1个图标 #465
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: Update Emui Res | |
on: | |
push: | |
paths: | |
- 'icons/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: push icons repo | |
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/icons | |
cp -a -r icons/* /tmp/icons | |
cd /tmp/icons | |
remote_repo="https://${{ secrets.GIT_USERS }}:${{ secrets.GIT_TOKEN }}@e.coding.net/miuiicons/icons/emui2.git" | |
git clone --depth 1 $remote_repo /tmp/dest | |
rm -rf /tmp/icons/.git | |
cp -r /tmp/dest/.git/ /tmp/icons/.git/ | |
for dir in *; do | |
if [ -d "$dir" ]; then | |
[ -f "$dir/0.png" ] && mv "$dir/0.png" "$dir/background.png" | |
[ -f "$dir/1.png" ] && mv "$dir/1.png" "$dir/foreground.png" | |
fi | |
done | |
git add . | |
git commit -m "${commit_msg}" || true | |
git push || true | |
cd .. | |
XZ_OPT=-9 tar cJf iconsrepo2.tar.xz icons | |
:> iconsrepo2.ini | |
echo "file_size=`ls -l ./iconsrepo2.tar.xz | awk '{print $5}'`" >> ./iconsrepo2.ini | |
echo "md5=`md5sum ./iconsrepo2.tar.xz|cut -d ' ' -f1`" >> ./iconsrepo2.ini | |
echo "theme_name=主图标仓库" >> ./iconsrepo2.ini | |
echo "theme_version=$(TZ=':Asia/Shanghai' date '+%Y%m%d%H%M')" >> ./iconsrepo2.ini | |
#curl -T iconsrepo2.tar.xz -u ${{secrets.coding_password}} "https://emuiicons-generic.pkg.coding.net/files/zip/iconsrepo2.tar.xz?version=latest" | |
curl -T iconsrepo2.ini -u ${{secrets.coding_password}} "https://emuiicons-generic.pkg.coding.net/files/zip/iconsrepo2.ini?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 iconsrepo2.tar.xz onedrive:/icons/emui | |
shell: bash |