Skip to content

API - Deploy Development Environment #1

API - Deploy Development Environment

API - Deploy Development Environment #1

Workflow file for this run

# API - Dev Server에 배포
name: API - Deploy Development Environment
on:
create:
push:
branches:
- release/Api-v*
- hotfix/Api-v*
jobs:
check-branch:
# Branch 이름 가져오기
if: ${{ github.event_name != 'create' || github.ref_type != 'tag' }}
runs-on: ubuntu-latest
outputs:
current_branch: ${{ steps.branch-name.outputs.current_branch }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
deploy-development-environment:
needs: check-branch
# release, hotfix 일때만 실행
if: startsWith(${{ needs.check-branch.outputs.current_branch}}, 'release/Api-v') || startsWith(${{ needs.check-branch.outputs.current_branch}}, 'hotfix/Api-v')
runs-on: 'ubuntu-latest'
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
token: ${{ secrets.MY_TOKEN }}
submodules: true
# JDK 환경 셋팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: gradle
# Gradle Permission
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Build
- name: Gradle build
run: |
./gradlew globalCopyConfig
./gradlew adevspoon-api:build -x test
# AWS Config
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Deploy to Lambda
- name: Deploy to lambda
run: |
# aws lambda update-function-code --function-name adevspoon-api --zip-file fileb://adevspoon-api/build/libs/adevspoon-api-*.jar