Skip to content

feat(beta): 招待ごとに世帯を割り当て、割り当ての無い招待は通さない (#78) #20

feat(beta): 招待ごとに世帯を割り当て、割り当ての無い招待は通さない (#78)

feat(beta): 招待ごとに世帯を割り当て、割り当ての無い招待は通さない (#78) #20

Workflow file for this run

name: Deploy API Lambda
on:
workflow_dispatch:
push:
branches:
- main
paths:
# Include the modules index.mjs imports, not just index.mjs.
# 2026-08-24: when consent.mjs was added this list only had index.mjs, so
# a change to consent.mjs alone did not trigger a deploy.
- 'backend/*.mjs'
- '.github/workflows/deploy-api.yml'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Run smoke tests
run: npm test
- name: Configure AWS credentials via OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
# Handler is index.handler, so index.mjs must sit at the zip root.
# -j strips the backend/ path. AWS SDK v3 is bundled in the nodejs runtime,
# so no node_modules are packaged.
#
# The modules index.mjs imports must go into the zip.
# 2026-08-24: when consent.mjs was added only index.mjs was zipped, so the
# deployed Lambda died on its import at startup
# (Cannot find module './consent.mjs'). That takes the whole API down.
# The zip succeeds and CI stays green, so nothing shows until the first
# invocation. tests/deploy-package.test.mjs catches a mismatch between what
# is imported and what is packaged.
- name: Package Lambda code
run: |
zip -j function.zip backend/index.mjs backend/consent.mjs
echo "--- zip の中身 ---"
unzip -l function.zip
# Lambda functions live in ap-northeast-1 (moved from us-east-1 on 2026-08-28).
# The AWS_REGION secret is a
# different region, so target the function region explicitly here
# (a region mismatch causes AccessDenied against the ap-northeast-1 ARN).
- name: Deploy to Lambda
run: |
aws lambda update-function-code \
--function-name gutpacer-backend \
--zip-file fileb://function.zip \
--region ap-northeast-1