diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index 3798619..4ba5273 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -4,10 +4,7 @@ inputs: webroot: description: The root directory of the web server that will be used to search for a file required: true - temproot: - description: The temproot directory of the web server that will be used to search for a file - required: true - serv: + systemd_service: description: Systemd service name required: true ssh_hostname: @@ -64,24 +61,21 @@ runs: - name: Build project working-directory: ui shell: sh - run: | - pnpm run build - rm -rf node_modules + run: pnpm run build - name: Deploy compiled project to the remote server shell: sh run: | + set -x + sshpass -p "${{ inputs.ssh_password }}" \ - rsync \ - --archive \ - --verbose \ - --human-readable \ - --delete-before \ - ${{ inputs.keep_source_maps == 'false' && '--exclude="*.map"' || '' }} ui/ ${{ inputs.ssh_username }}@${{ inputs.ssh_hostname }}:${{ inputs.webroot }}/ + ssh ${{ inputs.ssh_username }}@${{ inputs.ssh_hostname }} rm -rf ${{ inputs.webroot }}/* sshpass -p "${{ inputs.ssh_password }}" \ - ssh ${{ inputs.ssh_username }}@${{ inputs.ssh_hostname }} "sudo systemctl restart ${{ inputs.serv }}" + scp -r ui/ ${{ inputs.ssh_username }}@${{ inputs.ssh_hostname }}:${{ inputs.webroot }}/ + sshpass -p "${{ inputs.ssh_password }}" \ + ssh ${{ inputs.ssh_username }}@${{ inputs.ssh_hostname }} "sudo systemctl restart ${{ inputs.systemd_service }}" # - name: Copy Files to Server # shell: sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 418a5b9..5a30114 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,7 +48,7 @@ jobs: "ssh_password": "${{ secrets.FRONT_SCORE_SSH }}", "lib_latest": "true", "keep_source_maps": "false", - "serv": "names-test.service" + "systemd_service": "names-test.service" }, "^main$": { "node_env": "production", @@ -58,7 +58,7 @@ jobs: "ssh_password": "${{ secrets.FRONT_SCORE_SSH }}", "lib_latest": "false", "keep_source_maps": "false", - "serv": "names.service" + "systemd_service": "names.service" } } export_to: output,log @@ -69,7 +69,7 @@ jobs: with: webroot: ${{ steps.settings.outputs.webroot }} temproot: ${{ steps.settings.outputs.temproot }} - serv: ${{ steps.settings.outputs.serv }} + systemd_service: ${{ steps.settings.outputs.systemd_service }} ssh_hostname: ${{ steps.settings.outputs.ssh_hostname }} ssh_username: ${{ secrets.SERVER_USERNAME }} ssh_password: ${{ steps.settings.outputs.ssh_password }}