A note about the main branch. The main branch should be
main
in most newer projects. Some old projects will use the branchmaster
. In this document the namemain
will be used from here on out to describe the main branch, so keep that in mind if your project uses the branchmaster
.
A note about naming. Some projects will refer to this model as having
staging
andproduction
. In this document the namedevelopment
will be used from here on out to describe the "other" environment.
The develop
branch will be automatically deployed to Development. This should be the default branch, and you should merge new features and bug fixes into it.
The production environment should have the latest tag deployed. This tag will have the pattern release-YYYY-MM-DD-<num>
. This tag should correspond to a commit on the main
branch.
Merge a new PR into the develop
branch.
Merge a new PR into the main
branch. This will in turn automatically trigger a new release to be made, and this release should automatically be deployed to production.
You can also open a PR automatically either on a schedule, or by running the included workflow. The workflow should be named open-prod-pr.yml
.
To start a release process, do as follows:
From the repo frontpage, click "Click here to create a release to production" from the README. This should take you directly to the workflow. In the top right you should see a button saying "Run workflow".
Click the button "Run workflow" and accept the default values.
From time to time it can be either critical bugs or security issues that needs to go directly to prod. To do this, follow the following procedure:
- Check out
main
on your computer (for example withgit checkout main
). - Make sure your main branch is up to date (for example with
git pull origin main
) - Create a new branch from main (for example with
git checkout -b hotfix/critical-bug-123
) - Commit your changes to this branch
- Push your branch to github (for example with
git push -u origin hotfix/critical-bug-123
) - This should make it possible to create a new pull request, and you want to make sure your PR requests to merge into
main
(and not develop).
When this pull request has been merged, a new deployment should be automatically triggered to production.