Skip to content

feat: cicd 구축

feat: cicd 구축 #8

Workflow file for this run

name: Java CI with Gradle
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle Wrapper
run: ./gradlew clean build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Zip the JAR file
run: zip -r myapp.zip build/libs/*.jar appspec.yml scripts
- name: Upload the ZIP file to S3
run: aws s3 cp myapp.zip s3://wedle/
- name: Deploy to CodeDeploy
run: |
aws deploy create-deployment \
--application-name wedle \
--deployment-group-name wedle-group \
--deployment-config-name CodeDeployDefault.OneAtATime \
--description "Deploying from GitHub Actions" \
--file-exists-behavior OVERWRITE \
--s3-location bucket=wedle,key=myapp.zip,bundleType=zip
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'