I’ve always been a lazy developer of the sort. I hate repetition. I do not like to do things that I already did. But in my line of work, I’m kind of always required to do the same boring things over and over again. I can save myself from coding by making libraries of my own. But what about Build, Deploy, and Share? So here’s the problem I’m talking about.
Let's be realistic clients care less about engineering more about how it looks. Most often you would be fixing a button position and color than actual feature development. This may be a 2–3 minute change but to compile, test, build, deploy, and share this is a great hassle. Because all of that would take over 3–4 hours if done manually. Since clients are always right we do have to entertain these nonetheless.
Aside from the client-side issue, we have a developer side issue as well. When we are working in teams we would be working on different branches. Once a feature is ready we would need to merge pull requests and build the application all over again.
This makes us wonder hey, What if we hired someone to do these for us? For example, his/her task would be just to merge codes and build them and after that publish it via some store or something. And notify the end users after that.
Yeah, good luck telling your boss that. Ain’t nobody going to hire someone just to do this task. Also, I doubt anyone willing would get into such a boring job. Also, this is actually a delicate and crucial task that needs precision. So how do we solve the problem?
Well instead of solving the problem let's talk about what I want to do.
I just want to commit the changes of my code and I want the end-user to receive build updates.
As simple as it may sound, I need to set up some stuff initially before I can pull off such a thing.
I’m mainly a Unity 3D engineer. I make stuff with Unity. Just so you know Unity is a cross-platform tool with which you can develop Desktop, Web, Mobile, IoT applications with the same code base. So I’ve been asked to develop an application that runs on both Android and Desktop. So I’m basically adding one new layer of problem to our already existing ones. We now need to build for entirely different platforms. Well, unity does take care of most problems. But here’s what happens when I do the builds. I need to wait like 10 minutes to finish the desktop build and 10 minutes to re-import the project to Android and another 10 minutes to build for android. And in case there’s a bug I’d have to do the whole thing all over again. Add 10 minutes each time I need to change the build target.
Now 10 minutes might not sound much. But that’s minus 10 minutes out of my lifespan. I could be getting 10 extra minutes of sleep. Also if you count the number of changes you would need to do after your client makes their abrupt change requests. And if you are building for iOS, Write off 4 hours of your time for this. If anything I hate the most is wasting time. Because time is money.
I’m the type of person who only learns things when necessary. I’ve heard of this word CI/CD like 5 years ago. Now that I need automation I looked it up. I need to learn this. Because this will save me hours of repetitive work. I don’t have to save time to contribute more. I just want to save time because it’s my time. And also I’m actually very lazy. What’s the point of being an engineer if I keep doing the manual labor?
What is CI/CD? CI means Continuous Integration and CD means Continuous deployment. It sounds like it will solve our main problem, doesn’t it? I googled about how I can do CI/CD for Unity. There are a lot of services regarding this on the market. But the one that stood out to me most was GitHub Actions. My whole code was hosted on GitHub I’d like to have the automation done there as well. Because why not?
It took me around 3 months of playing around to actually get the CI to work. Or more like understand how it worked. I managed to write an automation script that automated the build process. What it did was, Whenever I merged on the Master/Main branch it started a server and built the application there, and uploaded the Artifact(apk / exe) on GitHub which I could download and share with the client. And this is totally free. Why hire someone else when a bot will do it for free. Alright, now I have the Integration and build issue resolved. But what’s the point in the building if I can’t share the build with stakeholders automatically?
Ideally what we would want is each time the build is made we would want all the stakeholders to receive a new update and get a mail too. If possible of course via play or app store but those require additional time so maybe some other alternative? At first, I thought I’ll try something like WeTransfer after the bot builds the app it can upload the file to WeTransfer and share the link via email. And the changelogs can be generated from the GitHub commits. Sadly I found out the API for WeTransfer is out of commission. Then I started looking for alternatives and found out File-Stack is a service similar to WeTransfer with API. To integrate with GitHub Actions workflow I had to learn some TypeScript and Node to make a GitHub action out of it. And finally, I made GitHub actions and published them via GitHub Marketplace.
Sounds smart right? Nope, that was a stupid move. I just didn’t research enough before I jumped right into problem-solving. My major takeaway from this was never to try to solve a problem as soon as possible. Try to understand the problem first and look at what are the existing solutions available instead of making something of your own from scratch. It appears that just like GitHub actions there’s another free service called App Center which does exactly what I needed and more. It’s basically a store like Play Store and App Store. You can upload builds here and send emails to the stakeholders even have changelogs set. And they have API too which means we can integrate it with our CI pipeline. And guess what Integrating a store with CI does for us? CD. Continuous Deployment. It appears that the GitHub marketplace already had an AppStore Action which I could use to upload the builds.
At this point, I was pretty happy. Now every time I push new changes, Some server does the build for me and uploads it to another downloadable file server, and sends the download link via email to all the stakeholders. This is where my problems are solved. But should it end here? Maybe I can help the client a little more with the automation.
If we are strictly talking about desktop solutions the client almost always faces one major problem. Installation. Like it or not even if it’s elementary most clients aren’t tech-savvy. And installing a desktop application looks pretty scary to them. Now if they had to go through an installation wizard each time we sent an update they’d get scared. They want something like what mobile apps do, you press the update button and the application is updated. No extra installation hassle. So how do we entertain that?
As a gamer, I’m familiar with the concept of launcher applications. What a launcher does is, manages some other application. It updates the application it runs the application. Even it can uninstall the application. What the clients need is one additional launcher application to manage their original application. To be honest they don’t even need to know it’s a different application. Hey as long as it works!
Being a unity developer has its perks. I can switch between .net development and unity at a moment's notice. I loaded up visual studio and cooked up this small launcher application(Open Sourced!!).
Which integrates the FREE API provided by the App center to download the latest builds from there which my automation uploaded after building with the changelogs. Good Guy Microsoft right? Since being lazy and all I made the project in a way so that I can use this launcher in all my future projects. To do that I just need to change the App Secret and be done with it.
Now the clients can get updates as soon as they are available. They don’t even need to open up an email or whatever. Whenever they try to use the app, If there’s an update they can just download it or continue to use the existing one. Trust me less the client whines about how it’s hard to install on the machine on employees that are too old to learn the better it is for you. Even if there’s someone too old to understand installation they can always press the update button.
Now I have a complete workflow ready. Now in the future, I’ll have my time saved thanks to the additional work I did during my projects. And over the course of my lifetime, I’ve probably saved a few hundreds of hours of boring work if not thousands. Now I can better spend my time playing games, learning new things, or sleeping.
| Task | Time(Minutes) | |
| Test | 2-3 | |
| Build | 10-20 | |
| Publish | 5-10 | |
| Distribute | 5-10 | |
| Notify | 5-10 | |
| =========== | ============== | |
| Total | 27-53 | |
As you can see I’m saving around 30–60 minutes per change request!
Work smart, not hard!