Skip to content

Commit

Permalink
Added documentation for automatic deployment
Browse files Browse the repository at this point in the history
Closes #490

Signed-off-by: Christian Wolf <github@christianwolf.email>
  • Loading branch information
christianlupus committed Jan 11, 2021
1 parent 9f874ed commit 4f4c561
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
79 changes: 79 additions & 0 deletions docs/dev/deployment.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
# Automatic deployment using Github Actions

* TOC
{:toc}

## Step-by-step guide to create a new release
The deployment of new releases is carried out using github actions.
This documentation should serve as a step-by-step basis instructions how to publish a new version.

Anyways these steps **do not cover any topics related to testing verification** of the functionality.
The person creating the release will have to make sure though other means that the version generated is valid.

### Preparations

You should have a local version of the repository at hands.
Check out the `master` branch and make sure it is up to date with the upstream branch.

### Create release branch

It is advised to create a new branch to prepare the release.
Through this text we assume, the release `1.2.4` should be generated while the last version was `1.2.3`.
So you might want to create a branch `release/1.2.4` from master.
```
git checkout -b release/1.2.4 master
```

### Update the changelog

In the release branch you will have to prepare the changelog file.
This means, you have to add a new second level heading to the unreleased changes so far.
You might need to add
```
## 1.2.4 - YYYY-mm-dd
```
as one of the first few lines with `YYYY-mm-dd` the current date.

Commit the changes and push them to github.

### Create pull request

Now, you should create a pull request to merge the changes in the new `release/1.2.4` branch into `stable`.
Do not yet merge the PR.
Here is the last chance to do some testing and verification.

### Let the actions do its magic

Now the critical part comes.
As soon as you merge the PR you set the gears into action and a new release will be published both on github and the NC appstore.

The version number that is going to be generated **depends on the commit message of the merge commit into `stable`**.
So before clicking on *Merge* be sure what you are doing.

By default you will generate a new patch version.
So the third part of our version would be incremented.
If you want to generate a different version type like minor (second part incremented) or major version (first part incremented), you need to make this visible.
You have to put a keyword on a line in the commit message to select a version type other than a patch version.

| Keyword | Version type | Generated version |
|---|---|---|
| no keyword | patch version | 1.2.4 |
| `%MINOR_VERSION%` | minor version | 1.3.0 |
| `%MAJOR_VERSION%` | major version | 2.0.0 |

The automatic deployment action will take over once you push to the `stable` branch.
The following actions will take place after the merge:

1. Some fixed parameters will be pre-filled in the codebase with the version number and a commit is generated on the `stable` branch.
1. A new tag `v1.2.4` is generated to save the current state in history on the `stable` branch.
1. The changes introduced in the commit are merged back into the `master` branch.
1. A github release is published and the compiled files are uploaded as a tarball.
1. A release in the nextcloud appstore is registered and published.

## Implementation details

The most recent version is stored in the files `major`, `minor`, and `patch` in `.github/actions/deploy/`.
These files should contain the major, minor and patch number of the *current* version known.
You should not alter these files manually, the action script will handle these files accordingly.

If you need to put the version string automatically somewhere in the code base, you might want to have a look at `fill-in-data.sh` in `.githib/actions/deploy`.
This file will du the changes to the files that need version-updates.
You should consider committing the changes in `create-version.sh` in the same folder if the file is already under version control to update the `master` branch accordingly.
4 changes: 4 additions & 0 deletions docs/dev/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Development documentation

This documentation should contain dedicated information about the cookbook app.
No general information about the internals of nextcloud should be published here as these tend to change and thus get dated.
Instead we want to reference the official documentation on [docs.nextcloud.com](https://docs.nextcloud.com), especially the development manual.

## Github related information

- [Automatic deployment of new releases](deployment)
Expand Down

0 comments on commit 4f4c561

Please sign in to comment.