diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..0db21d0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Deploy to Amazon EC2 + +on: + push: + branches: [ "develop" ] + +jobs: + deploy: + name: deploy + runs-on: ubuntu-latest + environment: production + + steps: + - name: setting-jdk17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'zulu' + + - name: checkout + uses: actions/checkout@v2 + + - name: test + run: ./gradlew clean test + + - name : build + run: ./gradlew build + + - name: copy file to Develop server via ssh key + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.AWS_HOST }} + username: ${{ secrets.AWS_USERNAME }} + key: ${{ secrets.AWS_SSH_KEY }} + source: "build/libs/*" + target: "/home/ubuntu/apiserver" + + - name: deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.AWS_HOST }} + username: ${{ secrets.AWS_USERNAME }} + key: ${{ secrets.AWS_SSH_KEY }} + script: | + sudo systemctl restart apiserver.service diff --git a/.github/workflows/prtest.yml b/.github/workflows/prtest.yml new file mode 100644 index 0000000..2b5ea15 --- /dev/null +++ b/.github/workflows/prtest.yml @@ -0,0 +1,21 @@ +name: PR TEST + +on: + pull_request: + branches: [ "develop", "main" ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: setting-jdk17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'zulu' + + - name: checkout + uses: actions/checkout@v2 + + - name: execute TestCode + run: ./gradlew clean test \ No newline at end of file