Merge pull request #17 from sw8744/main #41
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: Distribute to server | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| Build_and_distribute: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'corretto' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build --stacktrace | |
| - name: Prepare to sync | |
| run: | | |
| mkdir to_be_sync | |
| cp -r ./build/libs/ion-1.0.0.jar ./to_be_sync | |
| cp -r ./src/main/resources/static/static ./to_be_sync/static | |
| mv to_be_sync/ion-1.0.0.jar to_be_sync/ion.jar | |
| ls -al ./to_be_sync | |
| - name: Upload to FTP | |
| uses: SamKirkland/FTP-Deploy-Action@4.1.0 | |
| with: | |
| server: ionya.cc | |
| username: ${{ secrets.FTP_USER_NAME }} | |
| password: ${{ secrets.FTP_USER_PASSWORD }} | |
| protocol: ftp | |
| local-dir: ./backend/to_be_sync/ | |
| server-dir: ./ion/ | |
| - name: action-slack | |
| uses: 8398a7/action-slack@v3.12.0 | |
| with: | |
| status: custom | |
| fields: workflow,job,commit,repo,ref,author,took | |
| custom_payload: | | |
| { | |
| attachments: [{ | |
| color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', | |
| text: `커밋 ${process.env.AS_COMMIT}에 대한 배포작업이 끝났어요.\n결과: ${{ job.status }} in ${process.env.AS_TOOK}\n`, | |
| }] | |
| } | |
| author_name: "개발요정" | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| if: always() |