Bump lodash-es from 4.17.23 to 4.18.1 in /browser-extension #396
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GenU AutoDeploy | |
| on: | |
| pull_request_target: | |
| types: [labeled, synchronize, closed] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| if: >- | |
| (github.event.action == 'labeled' && github.event.label.name == 'auto-deploy') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'auto-deploy')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::047385030331:role/GenUAutoDeployRole | |
| aws-region: ap-northeast-1 | |
| - name: Run CodeBuild | |
| uses: aws-actions/aws-codebuild-run-build@v1 | |
| with: | |
| project-name: GenUAutoDeploy | |
| disable-source-override: true | |
| hide-cloudwatch-logs: true | |
| env-vars-for-codebuild: | | |
| PR_NUMBER, | |
| HEAD_REF, | |
| HEAD_REPOSITORY | |
| buildspec-override: | | |
| version: 0.2 | |
| phases: | |
| install: | |
| runtime-versions: | |
| nodejs: 20 | |
| commands: | |
| - echo "Cloning repository..." | |
| - git clone --branch ${HEAD_REF} https://github.com/${HEAD_REPOSITORY}.git /tmp/source | |
| - cd /tmp/source | |
| - echo "Node.js version:" | |
| - node --version | |
| - npm --version | |
| pre_build: | |
| commands: | |
| - echo "Installing dependencies..." | |
| - npm ci | |
| build: | |
| commands: | |
| - echo "Running CDK Bootstrap..." | |
| - npx -w packages/cdk cdk bootstrap | |
| - echo "Deploying environment -pr-${PR_NUMBER}..." | |
| - ENV_NAME="-pr-${PR_NUMBER}" | |
| - npm -w packages/cdk run -- cdk deploy --require-approval never --all -c env=${ENV_NAME} | |
| post_build: | |
| commands: | |
| - echo "Deployment completed successfully for environment pr-${PR_NUMBER}" | |
| - echo "Getting CloudFront URL..." | |
| - GENU_URL=$(aws cloudformation describe-stacks --stack-name GenerativeAiUseCasesStack-pr-${PR_NUMBER} --query 'Stacks[0].Outputs[?OutputKey==`WebUrl`].OutputValue' --output text --region ap-northeast-1 || echo "N/A") | |
| - echo "CloudFront URL is ${GENU_URL}" | |
| - PR_URL="https://github.com/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" | |
| - DEPLOY_TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S JST') | |
| - DEPLOY_STATUS="Success" | |
| - printf '{"ENV_NAME":"pr-%s","PR_NUMBER":"%s","BRANCH_NAME":"%s","GENU_URL":"%s","PR_URL":"%s","DEPLOY_STATUS":"%s","DEPLOY_TIMESTAMP":"%s"}' "${PR_NUMBER}" "${PR_NUMBER}" "${HEAD_REF}" "${GENU_URL}" "${PR_URL}" "${DEPLOY_STATUS}" "${DEPLOY_TIMESTAMP}" > /tmp/lambda-payload.json | |
| - cat /tmp/lambda-payload.json | |
| - echo "Sending Slack notification..." | |
| - aws lambda invoke --function-name GenUSlackNotification --region ap-northeast-1 --cli-binary-format raw-in-base64-out --payload file:///tmp/lambda-payload.json /tmp/lambda-response.json | |
| - cat /tmp/lambda-response.json | |
| - echo "Slack notification sent successfully" | |
| env: | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} | |
| cleanup: | |
| if: github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'auto-deploy') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::047385030331:role/GenUAutoDeployRole | |
| aws-region: ap-northeast-1 | |
| - name: Run CodeBuild for Cleanup | |
| uses: aws-actions/aws-codebuild-run-build@v1 | |
| with: | |
| project-name: GenUAutoDeploy | |
| disable-source-override: true | |
| hide-cloudwatch-logs: true | |
| env-vars-for-codebuild: | | |
| PR_NUMBER | |
| buildspec-override: | | |
| version: 0.2 | |
| phases: | |
| build: | |
| commands: | |
| - echo "Cleanup started for PR ${PR_NUMBER}" | |
| - STACK_NAME="GenerativeAiUseCasesStack-pr-${PR_NUMBER}" | |
| - echo "Checking for stack ${STACK_NAME}..." | |
| - if ! aws cloudformation describe-stacks --stack-name ${STACK_NAME} --region ap-northeast-1 2>/dev/null; then echo "Stack not found for this PR" && exit 0; fi | |
| - echo "Deleting stack ${STACK_NAME}..." | |
| - aws cloudformation delete-stack --stack-name ${STACK_NAME} --region ap-northeast-1 | |
| - echo "Waiting for stack deletion to complete..." | |
| - aws cloudformation wait stack-delete-complete --stack-name ${STACK_NAME} --region ap-northeast-1 | |
| - echo "Stack deletion completed successfully" | |
| env: | |
| PR_NUMBER: ${{ github.event.pull_request.number }} |