diff --git a/.github/skills/commit-message-generator/SKILL.md b/.github/skills/commit-message-generator/SKILL.md new file mode 100644 index 0000000..7a41080 --- /dev/null +++ b/.github/skills/commit-message-generator/SKILL.md @@ -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 && git commit -m ""` +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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4c4ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip diff --git a/ci/buildspec.yml b/ci/buildspec.yml new file mode 100644 index 0000000..cf0dcdf --- /dev/null +++ b/ci/buildspec.yml @@ -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" diff --git a/scripts/build-artifact.sh b/scripts/build-artifact.sh new file mode 100755 index 0000000..a508574 --- /dev/null +++ b/scripts/build-artifact.sh @@ -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"