chore: add CI/CD tooling and project configuration

- Add commit-message-generator skill for standardized commit messages
 - Add buildspec.yml for CodeBuild Docker image build process
 - Add build-artifact.sh script for creating deployment packages
 - Add .gitignore to exclude zip files from version control
This commit is contained in:
Daisuke Nakahara 2026-01-04 12:47:40 +09:00
parent 5e9c27cbf7
commit b9d4623d63
4 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,32 @@
---
name: commit-message-generator
description: Generate appropriate commit messages based on Git diffs
---
## Prerequisites
- This Skill retrieves Git diffs and suggests meaningful commit messages
- Message format should follow Conventional Commits
- Commit messages should be in English
- **Never perform Git commit or Git push**
## Steps
1. Run `git status` to check modified files
2. Retrieve diffs with `git diff` or `git diff --cached`
3. Analyze the diff content and determine if changes should be split into multiple commits
4. For each logical group of changes:
- List the target files
- Generate a message in English compliant with Conventional Commits
- Suggest the command: `git add <files> && git commit -m "<message>"`
5. If changes are extensive and should be split, provide:
- Rationale for the split
- Multiple commit suggestions with their respective target files and messages
## Commit Splitting Guidelines
- Split commits when changes span multiple logical concerns (e.g., feature + refactoring)
- Group related files that serve the same purpose
- Keep each commit focused on a single, atomic change
## Notes
- **This Skill must never execute `git commit` or `git push`**
- Only suggest commands; execution is entirely at user's discretion
- Users must explicitly perform commits and pushes themselves

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.zip

20
ci/buildspec.yml Normal file
View file

@ -0,0 +1,20 @@
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_REPOSITORY_URI
- IMAGE_TAG=$(date +%s)
- echo "Image tag will be ${IMAGE_TAG}"
build:
commands:
- echo Build started on `date`
- echo Building Docker image for ARM64/Lambda...
- docker build --platform linux/arm64 -f docker/Dockerfile -t $ECR_REPOSITORY_URI:$IMAGE_TAG -t $ECR_REPOSITORY_URI:latest .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing Docker images...
- docker push $ECR_REPOSITORY_URI:$IMAGE_TAG
- docker push $ECR_REPOSITORY_URI:latest
- echo "Image pushed with tags ${IMAGE_TAG} and latest"

39
scripts/build-artifact.sh Executable file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
ARTIFACT_DIR="${ROOT_DIR}/artifacts"
ZIP_PATH="${ARTIFACT_DIR}/blog-lambda-source.zip"
echo "Building artifact for blog-lambda pipeline..."
echo "Root directory: ${ROOT_DIR}"
mkdir -p "${ARTIFACT_DIR}"
# Create temporary directory for staging files
tmpdir="$(mktemp -d)"
trap 'rm -rf "${tmpdir}"' EXIT
# Copy necessary files for CodeBuild
echo "Copying source files..."
cp -r "${ROOT_DIR}/cmd" "${tmpdir}/cmd"
cp -r "${ROOT_DIR}/docker" "${tmpdir}/docker"
cp -r "${ROOT_DIR}/ci" "${tmpdir}/ci"
cp "${ROOT_DIR}/go.mod" "${tmpdir}/go.mod"
cp "${ROOT_DIR}/go.sum" "${tmpdir}/go.sum"
# Create the ZIP archive
echo "Creating ZIP archive..."
(
cd "${tmpdir}"
zip -r "${ZIP_PATH}" . -x "*.git*" "*.DS_Store"
)
# Display artifact info
echo ""
echo "✅ Artifact created successfully!"
echo " Path: ${ZIP_PATH}"
echo " Size: $(du -h "${ZIP_PATH}" | cut -f1)"
echo ""
echo "To upload to S3:"
echo " aws s3 cp ${ZIP_PATH} s3://\${BUCKET_NAME}/blog-lambda-source.zip"