I write Javascript code for the web which I usually minify before uploading. I do it locally with a dedicated tool (like UglifyJS) but I would like to automate the process slightly using Gitlab Continuous Integration (because I use Gitlab on this project).
My aim seems quite simple: use Gitlab CI to minify the code on certain events and output these files in a convenient way for me to get them.
However, I haven't found anything (tutorial or other) to do this yet.
I have very little experience with Gitlab CI so I don't really know where to start but I have tried breaking that into smaller problems: - I can't find a simple script that does compression/minification that I could run using Gitlab CI, it's mostly bigger utilities (YUI Compressor, Google Closure Compiler). - If I find a way to compress the files can I push them on my repository from the CI? And if yes, I am wondering if that's actually good practice because that would version the minified files which is not useful.
My best shot at something not too complicated seems to be Google Closure Compiler which can be used with its API. And if I understand correctly, I could use Gitlab's Webhooks to make that API call (not sure exactly how I would pass the data this way but I'll see what I can do). But then, how can I read the response (Gitlab Webhooks don't seem fit for that) ? Maybe it would be better to make these API calls in Gitlab CI directly but I am not sure how to be honest and mostly how I can get the compressed data back and what I could do with it (where to store it).