From a Version Tag to the Store: Automating Our Fire TV Releases

From a Version Tag to the Store: Automating Our Fire TV Releases

Every Fire TV update used to mean the same manual routine: build a signed release, check it, attach it to a GitHub Release, then upload it to the Amazon Appstore carefully, so nothing gets sent for review by accident. With several apps, that's a lot of repeated steps, and every repeated manual step is a chance to upload the wrong file.

So we automated it. Now one version tag does the boring part, and the important decision stays with a person.

What happens when we push a tag

The pipeline runs on GitHub Actions in every Fire TV app repository. It starts when we push a version tag, or when we start it by hand. Then it:

  • Checks out the tagged code and fetches our private framework.
  • Builds a signed release APK with JDK 17.
  • Verifies the result: the signature, and the contents. It rejects debuggable builds and any package that contains tests, signing files or READMEs.
  • Attaches the APK to a GitHub Release, so every version has a clear, downloadable artifact.
  • Uploads the APK to the open Amazon edit through Amazon's App Submission API, if store credentials are set up for that app.

A full run takes about 3.5 to 7 minutes. Our smallest app finishes in a bit under four minutes, and the biggest in under seven.

It never presses "Submit"

The most important rule is what the pipeline does not do. It uploads into Amazon's edit but never commits the edit, so it never submits anything for review.

Submitting stays a human step. Someone opens the console, checks the listing, the screenshots, the prices and the release notes, and only then submits. Automation is great for building and uploading files, and bad at noticing that a screenshot shows the wrong language.

Secrets and test builds

Signing material and API credentials live only in the CI secret store. They are never in the repository, never in logs, never on a developer's desk in a forgotten folder.

We also make a few debuggable builds, for example to test purchases or take price screenshots. Those are never uploaded. The pipeline's content check makes this hard to get wrong: a debuggable APK simply fails the job.

The 412 surprise

The first time we tagged a brand-new app, the upload step failed with HTTP 412. Amazon's message said it couldn't create a new edit for the app in its current state.

It turns out the API can't create the first version of an app. A brand-new app needs its first APK uploaded by hand in the console. After that, later versions can go through the API.

So the path for a new app is:

  • Push the tag. The pipeline builds the APK, verifies it and attaches it to the GitHub Release. The Amazon step fails, and that's expected.
  • Download that exact APK from the GitHub Release and upload it by hand in the console.
  • From the next version on, the pipeline handles the upload.

The nice part is that the manual upload still uses the verified, signed file from the pipeline, not something built on a laptop.

412 again, later

412 can also show up for later versions. If Amazon won't open a new edit, for example because a version is still under review, the upload step fails the same way. We saw this on two apps on the same day.

The job turns red, but the signed APK and the GitHub Release were made fine. Only the last step failed. On two other apps the Amazon step went through completely.

That's worth knowing before you panic at a red job. We read the failing step first: if it's the Amazon upload with a 412, the build is fine and we just upload later, once the store will accept a new edit.

What we gained

  • One action per release: push a tag.
  • Every version has a verified, signed artifact in a GitHub Release.
  • No debuggable build can reach the store by mistake.
  • No accidental submissions, because a person always does the final review and submit.
  • The same workflow in every Fire TV app, so a fix to the pipeline is made once and copied everywhere.

Takeaway

  • Automate the build and the upload, not the decision. Keep "submit for review" a human step.
  • Check the package, not just the build. Reject debuggable builds and stray files automatically.
  • Keep credentials in the CI secret store only.
  • Expect the store's first-version rule. The first upload of a new app may have to be manual.
  • Read which step failed. A red job after a 412 can still mean a perfectly good release file.
Go To All Articles