Skip to content

use appleboy ssh action #33

use appleboy ssh action

use appleboy ssh action #33

Workflow file for this run

name: Deploy
on:
pull_request:
branches:
- develop
env:
PUBLIC: "~/motsflex-save/public"
ASSETS: "$PUBLIC/assets"
INDEX_HTML: "$PUBLIC/index.html"
DICOS: "~/dicos"
SERVER: "~/motsflex-save/server.js"
SSH_TARGET: ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}
jobs:
deploy:
runs-on: ubuntu-latest
# if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Determine Deployment Type
if: ${{ success() }}
run: |
echo "DEPLOY_ASSETS=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:assets') }}" >> $GITHUB_ENV
echo "DEPLOY_SERVER=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:server') }}" >> $GITHUB_ENV
echo "DEPLOY_CLIENT=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:client') }}" >> $GITHUB_ENV
- name: Install Dependencies
if: ${{ success() }}
run: npm install
- name: Build
if: ${{ success() }}
run: npm run build
- name: Deploy
if: ${{ success() }}
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
port: 22
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
if [[ "${{ env.DEPLOY_ASSETS }}" == 'true' ]]; then

Check failure on line 53 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 53
echo "Deploying JS assets"
ssh $SSH_TARGET "rm -rf $ASSETS && mkdir -p $ASSETS"
scp -r dist/public/assets $SSH_TARGET:$ASSETS
scp -r dist/public/index.html $SSH_TARGET:$INDEX_HTML
fi
if [[ "${{ env.DEPLOY_CLIENT }}" == 'true' ]]; then
echo "Deploying full client"
ssh $SSH_TARGET "rm -rf $PUBLIC && mkdir -p $PUBLIC"
scp -r dist/public $SSH_TARGET:$PUBLIC
ssh $SSH_TARGET "cp $DICOS/*.zip $ASSETS"
fi
if [[ "${{ env.DEPLOY_SERVER }}" == 'true' ]]; then
echo "Deploying server code"
scp -r dist/server.js $SSH_TARGET:$SERVER
fi