update and remove new line char #239
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: Build and Deploy to production | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@master | |
| - name: Use Node.js | |
| uses: actions/setup-node@v1 | |
| with: | |
| node-version: 14.17.6 | |
| - run: npm install --production | |
| - run: npm run build-prod | |
| - run: mv dist server/front | |
| - run: cd server && npm install --production && cd .. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: server/ | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Delete old files | |
| uses: appleboy/ssh-action@v0.1.3 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| shopt -s extglob | |
| sudo systemctl stop ${{ secrets.SERVICE_NAME_PROD }} | |
| cd ${{ secrets.DEPLOY_TARGET }} | |
| rm -rf !(build-db.sqlite) | |
| - name: Upload files | |
| uses: appleboy/scp-action@v0.1.3 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: ${{ secrets.PORT }} | |
| strip_components: 1 | |
| source: "dist" | |
| target: "${{ secrets.DEPLOY_TARGET }}" | |
| restart: | |
| runs-on: ubuntu-latest | |
| needs: deploy | |
| steps: | |
| - name: Restart service | |
| uses: appleboy/ssh-action@v0.1.3 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| sudo systemctl start ${{ secrets.SERVICE_NAME_PROD }} |