Unciv/site/wiki/From-code-to-deployment/index.html
Yair Morgenstern d255bf3fa7 mkdocs build
2022-02-23 20:20:48 +02:00

882 lines
25 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.2.3, mkdocs-material-8.2.1">
<title>From code to deployment - My Docs</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.e8d9bf0c.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.e6a45f82.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<script>__md_scope=new URL("../..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="none" data-md-color-accent="none">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#from-code-to-deployment" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="My Docs" class="md-header__button md-logo" aria-label="My Docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
My Docs
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
From code to deployment
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="My Docs" class="md-nav__button md-logo" aria-label="My Docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
My Docs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
Welcome to MkDocs
</a>
</li>
<li class="md-nav__item">
<a href="../../Credits/" class="md-nav__link">
Icon Credits
</a>
</li>
<li class="md-nav__item">
<a href="../../Game%20Making%20Tips/" class="md-nav__link">
Tips and tricks for making a LibGDX game
</a>
</li>
<li class="md-nav__item">
<a href="../../unique%20parameters/" class="md-nav__link">
Unique parameters
</a>
</li>
<li class="md-nav__item">
<a href="../../uniques/" class="md-nav__link">
Uniques
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" checked>
<label class="md-nav__link" for="__nav_6">
Wiki
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Wiki" data-md-level="1">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Wiki
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../Audiovisual-Mods/" class="md-nav__link">
Audiovisual Mods
</a>
</li>
<li class="md-nav__item">
<a href="../Building-locally-without-Android-Studio/" class="md-nav__link">
Building locally without Android Studio
</a>
</li>
<li class="md-nav__item">
<a href="../Civilization-related-JSON-files/" class="md-nav__link">
Civilization related JSON files
</a>
</li>
<li class="md-nav__item">
<a href="../Coding-standards/" class="md-nav__link">
Coding standards
</a>
</li>
<li class="md-nav__item">
<a href="../Creating-a-custom-tileset/" class="md-nav__link">
How to make Unciv use your custom tileset
</a>
</li>
<li class="md-nav__item">
<a href="../Force-rating-calculation/" class="md-nav__link">
Force rating
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
From code to deployment
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
From code to deployment
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#getting-your-code-in-the-main-repo" class="md-nav__link">
Getting your code in the main repo
</a>
</li>
<li class="md-nav__item">
<a href="#deploying-versions" class="md-nav__link">
Deploying versions
</a>
</li>
<li class="md-nav__item">
<a href="#about-google-play-publishing" class="md-nav__link">
About Google Play publishing
</a>
</li>
<li class="md-nav__item">
<a href="#updating-the-wiki" class="md-nav__link">
Updating the wiki
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../Getting-Started/" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a href="../Home/" class="md-nav__link">
Home
</a>
</li>
<li class="md-nav__item">
<a href="../Installing-on-macOS/" class="md-nav__link">
Installing on macOS
</a>
</li>
<li class="md-nav__item">
<a href="../JSON-files-for-mods/" class="md-nav__link">
JSON files for mods
</a>
</li>
<li class="md-nav__item">
<a href="../Making-a-new-Civilization/" class="md-nav__link">
Making a new Civilization
</a>
</li>
<li class="md-nav__item">
<a href="../Map-related-JSON-files/" class="md-nav__link">
Map related JSON files
</a>
</li>
<li class="md-nav__item">
<a href="../Miscellaneous-JSON-files/" class="md-nav__link">
Miscellaneous JSON files
</a>
</li>
<li class="md-nav__item">
<a href="../Mods/" class="md-nav__link">
Mods
</a>
</li>
<li class="md-nav__item">
<a href="../Project-structure-and-major-classes/" class="md-nav__link">
Project structure
</a>
</li>
<li class="md-nav__item">
<a href="../Regions/" class="md-nav__link">
Regions
</a>
</li>
<li class="md-nav__item">
<a href="../Translating/" class="md-nav__link">
Translating
</a>
</li>
<li class="md-nav__item">
<a href="../Translations%2C-mods%2C-and-modding-freedom-in-Open-Source/" class="md-nav__link">
Translations, mods, and modding freedom in Open Source
</a>
</li>
<li class="md-nav__item">
<a href="../Uniques/" class="md-nav__link">
Uniques
</a>
</li>
<li class="md-nav__item">
<a href="../Unit-related-JSON-files/" class="md-nav__link">
Unit related JSON files
</a>
</li>
<li class="md-nav__item">
<a href="../_Footer/" class="md-nav__link">
Footer
</a>
</li>
<li class="md-nav__item">
<a href="../_Sidebar/" class="md-nav__link">
[Home](.)
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#getting-your-code-in-the-main-repo" class="md-nav__link">
Getting your code in the main repo
</a>
</li>
<li class="md-nav__item">
<a href="#deploying-versions" class="md-nav__link">
Deploying versions
</a>
</li>
<li class="md-nav__item">
<a href="#about-google-play-publishing" class="md-nav__link">
About Google Play publishing
</a>
</li>
<li class="md-nav__item">
<a href="#updating-the-wiki" class="md-nav__link">
Updating the wiki
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="from-code-to-deployment">From code to deployment</h1>
<p>So, your code works! You've solved all the bugs and now you just need to get it out to everyone!</p>
<p>So, how does THAT work?</p>
<p>The process has two major parts, one is "Getting your code in the main repository" and the other is "Deploying versions" - as a developer, you'll be taking an active part in the first process, but the second process is on me =)</p>
<h2 id="getting-your-code-in-the-main-repo">Getting your code in the main repo</h2>
<ul>
<li>First off, push your changes with Git to your own branch at https://github.com/YourUsername/Unciv.git. I hope you've been doing this during development too, but that's none of my business *sips tea*</li>
<li>Issue a pull request from https://github.com/YourUsername/Unciv - from the Pull Requests is the simplest</li>
<li>The Travis build will check that your proposed change builds properly and passes all tests</li>
<li>I'll go over your pull request and will ask questions and request changes - this is not only for code quality and standard, it's mostly so you can learn how the repo works for the next change you make =)</li>
<li>When everything looks good, I'll merge your code in and it'll enter the next release!</li>
</ul>
<h2 id="deploying-versions">Deploying versions</h2>
<p>When I'm ready to release a new version I:
* Comment "merge translations" in one of the open PRs tagged as 'mergeable translation' to trigger the translation branch creation, add a "summary" comment to trigger summary generation, merge the PR and delete the branch (so next version translation branch starts fresh)
* From my workstation - pull the latest changes and run the <a href="../Translating/#translation-generation---for-developers">translation generation</a>
* Change the versionCode and versionName in the Android build.gradle so that Google Play and F-droid can recognize that it's a different release
* Add an entry in the changelog.md done, WITHOUT hashtags, and less than 500 characters (that's the limit for Google play entries). The formatting needs to be exact or the text sent to Discord, the Github release etc. won't be complete.
* Add a tag to the commit of the version. When the <a href="https://github.com/yairm210/Unciv/actions/workflows/buildAndDeploy.yml">Github action</a> sees that we've added a tag, it will run a build, and this time (because of the configuration we put in the <a href="/.github/workflows/buildAndDeploy.yml">yml file</a> file), it will:
* Pack a .jar file, which will work for every operating system with Java
* Use Linux and Windows JDKs to create standalone zips for 32 and 64 bit systems, because we can't rely on the fact that users will have a JRE
* Download <a href="https://itch.io/docs/butler/installing.html">Butler</a> and use it to <a href="https://itch.io/docs/butler/pushing.html">push</a> the new versions to the <a href="https://yairm210.itch.io/unciv">itch.io page</a>
* Read the changelog.md file to get the changes for the latest version
* Upload all of these files to a new release on Github, with the release notes, which will get added to the <a href="https://github.com/yairm210/Unciv/releases">Releases</a> page
* Send an announcement on the Discord server of the version release and release notes via webhook
* Pack, Sign, and Upload a new APK to the Google Play Console at 10% rollout
* The F-Droid bot checks periodically if we added a new tag. When it recognizes that we did, it will update the <a href="https://gitlab.com/fdroid/fdroiddata/blob/master/metadata/com.unciv.app.yml">yaml file here</a>
* When the bot next runs and sees that there's a version it doesn't have a release for, it will attempt to build the new release. The log of the build will be added <a href="https://f-droid.org/wiki/page/com.unciv.app/lastbuild">here</a> (redirects to the latest build), and the new release will eventually be available <a href="https://f-droid.org/en/packages/com.unciv.app/">here</a></p>
<h2 id="about-google-play-publishing">About Google Play publishing</h2>
<p>+We start at a 10% rollout, after a day with no major problems go to 30%, and after another day to 100%. If you were counting that means that most players will get the new version after 2+ days.
+
+If there were problems, we halt the current rollout, fix the problems, and release a patch version, which starts at 10% again.
+
+Dear future me - the automation was extremely annoying guesswork to set up, so the facts you need to know are:
- There is a user at the <a href="https://console.cloud.google.com/iam-admin/iam">Google Cloud Platform Account Manager</a> called Unciv_Upload_Account. There is an access key to this account, in json, stored as the Github secret GOOGLE_PLAY_SERVICE_ACCOUNT_JSON.
- This user was granted ADMIN permissions to the Google Play (after much trial and error since nothing else seemed to work) under User &gt; Users and Permissions. Under Manage &gt; Account permissions, you can see that it has Admin.</p>
<h2 id="updating-the-wiki">Updating the wiki</h2>
<p>Pages for the <a href="https://github.com/yairm210/Unciv/wiki/">Unciv Github Wiki</a> are kept in the main repository under <a href="/docs/wiki">/docs/wiki</a>.</p>
<p>The process to edit the wiki is as follows:</p>
<ol>
<li>Open a pull request in the main Unciv repository that changes files under <a href="/docs/wiki">/docs/wiki</a>.</li>
<li>Once the pull request is merged, an account with commit privileges on the Unciv repository leaves a comment saying "<code>update wiki</code>".</li>
<li>This comment triggers a bot to copy all the wiki files from the main repository into the Github wiki, with a link back to the PR in its commit message for credit.</li>
</ol>
<p>Doing things this way has several distinct advantages over using the Github Wiki web interface directly:</p>
<ul>
<li>Changes can be proposed via PR and proofread or fact-checked.</li>
<li>A proper MarkDown editor or IDE can be used to write the wiki, bringing faster editing, clickable links while editing, better live HTML preview, and automatic detection of problems like broken links.</li>
<li>The wiki files can also be browsed at https://github.com/yairm210/Unciv/tree/master/docs/wiki.</li>
<li>Auto-generated documentation made by the build process can be placed directly in the wiki.</li>
</ul>
<p>However, it also imposes a couple of conventions about how links should best be formatted:</p>
<table>
<thead>
<tr>
<th>Link type</th>
<th>Format</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>Inter-wiki</td>
<td>Should begin with "./", and include ".md".</td>
<td><a href="../Mods/#other"><code>./Mods.md#other</code></a></td>
</tr>
<tr>
<td>Code or asset file</td>
<td>Should begin with "/", and be relative to the project root.</td>
<td><a href="/android/assets/game.png"><code>/android/assets/game.png</code></a></td>
</tr>
</tbody>
</table>
<p>These formats will allow IDEs like Android studio to resolve these links and check for broken links, while also working on the <a href="https://github.com/yairm210/Unciv/tree/master/docs/wiki">Github code browser</a>.</p>
<p>The bot that updates the wiki from the main repository automatically translates them into formats that are compatible with Github Wikis, which have somewhat non-standard requirements.</p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer">
<a href="../Force-rating-calculation/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Force rating" rel="prev">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Previous
</span>
Force rating
</div>
</div>
</a>
<a href="../Getting-Started/" class="md-footer__link md-footer__link--next" aria-label="Next: Getting Started" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
Getting Started
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../..", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "../../assets/javascripts/workers/search.bd0b6b67.min.js"}</script>
<script src="../../assets/javascripts/bundle.8aa65030.min.js"></script>
</body>
</html>