This file contains 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: Deploy to Server | |
# on: | |
# push: | |
# branches: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# - name: executing remote ssh commands using passwordss | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.REMOTE_HOST }} | |
# username: ${{ secrets.REMOTE_USERNAME }} | |
# key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# script: | | |
# whoami | |
# - name: Checkout codecs | |
# uses: actions/checkout@v2 | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - run: mkdir ~/distfiles | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# name: distfiles | |
# path: distfiles | |
# - name: Deploy dive preview | |
# uses: appleboy/[email protected] | |
# with: | |
# host: ${{ secrets.SERVER }} | |
# username: ${{ secrets.USER }} | |
# key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# rm: true | |
# source: distfiles/* | |
# target: "${{ secrets.TARGET_DIR }}" | |
# - name: Run scripts on servers via SSH | |
# uses: appleboy/[email protected] | |
# with: | |
# host: ${{ secrets.REMOTE_HOST }} | |
# username: ${{ secrets.REMOTE_USERNAME }} | |
# port: ${{ secrets.SSH_PORT }} | |
# key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# script: | | |
# sudo apt install nginx | |
# - name: copy file via ssh keyss | |
# uses: appleboy/[email protected] | |
# with: | |
# host: ${{ secrets.REMOTE_HOST }} | |
# username: ${{ secrets.REMOTE_USERNAME }} | |
# port: ${{ secrets.SSH_PORT }} | |
# key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# source: ./help.txt | |
# target: /tmp | |
- name: Install SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# - name: Copy files | |
# run: scp -P 22 path/to/files ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }}:/tmp | |
- name: Update Git code on the serverssss | |
run: | | |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "ls" | |
- name: Install dependencies | |
run: | | |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "cd /home/ubuntu/devops_class/all_in_docker/client && npm install" | |
- name: Start the Node.js application | |
run: | | |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "cd /home/ubuntu/devops_class/all_in_docker && npm start" |