BruceWind / CompressImagesInAndroid

to automaticly compress large imgs on CI/Actions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

中文

CompressingAndroidRes

Compressing images by shell on github-action or github-ci.

Background

Some engineers have been complaining about colleagues uploading large images into Android projects. Thus, some people may want to run a shell to compress all large images, however, compressing image is so slow on computers. It cost too much time and might have overheated computers.

There are several approches to achieve our goal.

In my humble opinion, the best way of them is creating a automatic task to compress them on server. So I made this. It can automatically work on github-action or gitlab-ci so that you don't need to spent time on compressing large images.

In this repo, an exemple for starting an automatic task to do that. It could work with in Gitlab CI and Github Actions.

Github Actions

Fistly, you start a manual action to.

And then, action will push some images compressed if need.

Gitlab CI

In Gitlab, everything is automatic. Some environment may provide manual way to run compressing. But I did not give the example, you can change code to achieve.

Plan

  • compressing images that below res directory in shell script.
  • compressing images in gitlab-ci and then commit new file.
  • works on gitlab-ci, and automatically commit new files.
  • supporting FLIF format.

In addition

You still can run shell without CI or Actions task.

Furthermore, it work not only in Android project but also ios project, or other projects-just need a little bit change.

Remind

  1. Before cloning this repo, you should install git-lfs .

About

to automaticly compress large imgs on CI/Actions.


Languages

Language:Shell 100.0%