-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: deploy_lambda | ||
|
||
on: | ||
push: | ||
branches: [ feat/like_service ] | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
tags: | ||
description: 'Test Deploy' | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: JDK 세팅 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle without test | ||
run: ./gradlew build -x test | ||
|
||
- name: Create deployment package | ||
run: | | ||
mkdir -p deployment | ||
cp build/libs/*.jar deployment/ | ||
if [ -d "lib" ]; then | ||
cp -R lib/* deployment/ | ||
fi | ||
cd deployment | ||
zip -r ../function.zip . | ||
- name: AWS 계정 세팅 | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: S3에 패키지 업로드 | ||
run: | | ||
aws s3 cp function.zip s3://gureumi-s3/deploy/function.zip | ||
- name: 람다 배포 | ||
run: | | ||
aws lambda update-function-code \ | ||
--function-name ${{ secrets.LAMBDA_FUNCTION_NAME }} \ | ||
--s3-bucket gureumi-s3 \ | ||
--s3-key deploy/function.zip |