CI
DevLaunchPad ships with a GitHub workflow to automatically build, test, and deploy your webapp whenever you push code.
The workflow is defined in .github/workflows/ci.yml which GitHub picks up automatically. But for it to work correctly, there are two things you must first configure.
1. GitHub role
DevLaunchPad creates a role in AWS for CI workflows running in your GitHub repository. When workflows assume the role, they can freely create or update resources in your AWS account.
Open deployment-params.yml and set GitHubRepositoryName
.
GitHubRepositoryName: 'your-account/your-repo'
Now create the GitHub role by running npm run deployInitial -- -p
.
The new role can only be used by workflows running in the repository specified above.
Next, configure GitHub to know about the role it must assume.
2. Secrets
In GitHub, go to Settings > Secrets and variables > Actions and add new repository secrets for:
AWS_ROLE_TO_ASSUME
- the role the workflow assumes to deploy your webapp to AWS. The role is automatically created when you runnpm run deployInitial -- -p
. Use the value printed in the command output to set this variable.SERVERLESS_ACCESS_KEY
- the key for deploying infrastructure using Serverless Framework. Go to app.serverless.com, create an account, then create a new key under Settings > Access Keys.
With these configurations in place, every time you push code GitHub will build, test, and deploy your webapp to dev then prod.