This document is meant to explain the steps to take when recovering from a disaster and also to explain the content of appveyor.yml
and associated files.
The deploy procedure is set up to run with AppVeyor. To use the config in the projects appveyor.yml
you need to log onto an existing AppVeyor account, ours is in the 1Password vault. The only project settings you need to worry about on the AppVeyor site is the general settings.
- GitHub repository needs to be specified (
PayEx/design.payex.com
). - Default branch needs to be set to
master
. - Webhook URL needs to be generated through github by adding the new AppVeyor account to the repository/organization.
- Custom configuration
.yml
file name needs to be specified asbuild/appveyor.yml
.
This should be enough manual configuration to make sure a commit pushed to master
with a tag will deploy the project.
Set to build all branches except gh-pages
.
Setting the following encrypted environment variables:
access_token
- Github token used to authenticate when pushing togh-pages
. Used by the powershell script ran in thebefore_deply
step.github_email
- Email account to the payex bot user that pushes new releases togh-pages
. Used by the powershell script ran in thebefore_deply
step.sentry_token
- API key to sentry. Used by the powershell script ran in thebefore_build
step.
Installing and running gitversion
to properly version the build. Also sets a lot of useful environment variables.
Running npm install
to install all the projects dependencies.
In the before_build
step powershell runs the script prepare-release-build.ps1
which checks if the current build is from master
with a tag or not. If it is, it will replace <token>
in the .sentryclirc
file with our Sentry API key to make sure webpack will be able to create a new release on Sentry. It will also set the environment variable release
to "true"
(this variable will be injected to the npm script ran in the next step). If not it will not modify .sentryclirc
and set the environment variable release
to "false"
.
The build_script
step runs the npm script npm run build:prod
with the injected environment variable release
(created in the last step) to let webpack know wether it should create a release bundle or not.
Simply runs the npm scripts lint
and test
.
Runs the powershell script deploy-github-pages.ps1
.
This script checks if the current build is coming from a commit on master
with a tag. If it does not this script does nothing. If it does then it:
- Creates an AppVeyor artifact from the designguide build zip file generated by webpack in the build step.
- Creates the environment variable
changelog
(later used to publish a release on GitHub), and sets that to the content ofCHANGELOG.md
. - Makes sure it configures the git user settings to the payex bot user using the environment variables
github_email
,USERPROFILE
andaccess_token
. - Checks out branch
gh-pages
. - Copies the content of the
dist
folder toroot
. - Adds the modified and new files to a commit and pushes it to the branch
gh-pages
.
Creates a release on GitHub.
auth_token
is an encrypted environment variable containing a github access token for the payex bot user.release
is specified with the environment variableGitVersion_SemVer
(i.e.1.1.3
) generated by GitVersion in theinstall
step.tag
is specifed as the environment variableAPPVEYOR_REPO_TAG_NAME
generated by AppVeyor when pushing a commit with a tag.description
is set to the environment variablechangelog
created by thedeploy-github-pages.ps1
in the previous step.artifact
specifies what artifact to publish with the release. It is set to the zip file generated by webpack in the build step and uploaded in the previous step.prerelease
is set to false for now, as we have yet to reach version 1.
Configures slack notifications when building the project. Specifies which channel to report to, what to report and an encrypted webhook to slack.