The GitHub action ci.yml
contains the following:
- run
./gradlew check
to make sure all tests pass. - use semantic-release to manage release versions.
CHANGELOG
will be updated if a new release being generated.version
ingradle.properties
will be updated with the new version number.- new version
tag
will be created.
- dockerise the application
./gradlew assemble
to package the artifact (uber-jar).- use
docker build
to build the application and imagetag
with SHA and version.Dockerfile
will package the uber-jar from./gradle assemble
to the image.
- use
docker push
to push the image to Amazon ECR.- the image will have two tags, one is the application version, the other one is the SHA of the commit as tag.
- This project uses pre-commit with the following hooks.
pre-commit install --install-hooks -t pre-commit -t commit-msg -t pre-push
- If installed correctly, it will:
- check whether the commit message is following conventional-commit format.
- run
./gradlew build
before push to make sure all tests passes.
- Please update
settings.gradle.kts
andgradle.properties
to the correct name and version (0.0.1) of the project. - remove the
CHANGELOG.md
file - This project also uses spotless to make sure the project is properly formatted.
As this project uses Amazon ECR as the application image repository, it will require all the necessary credentials being setup in AWS.
- Create a dedicated system user in AWS which contains these permissions.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ecr:PutLifecyclePolicy",
"ecr:CreateRepository",
"ecr:DescribeRepositories"
],
"Resource": "arn:aws:ecr:*:<your-account-id>:repository/*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "ecr:DescribeRegistry",
"Resource": "*"
}
]
}
- Generate API Key and Secret for this user.
- Import the API Key as
AWS_ACCESS_KEY_ID
and API Secret asAWS_SECRET_ACCESS_KEY
into the GitHub Project Settings.- Settings -> Secrets -> Actions and create the two secrets. (ex: https://github.com/lawkai/http4k-template/settings/secrets/actions)
- TODO