Skip to content

Update main.yml

Update main.yml #6

Workflow file for this run

name: Deploy to Server
# main 브랜치로 푸시할 때 이 워크플로우 실행
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# GitHub에서 리포지토리 코드를 가져오는 단계
- name: Checkout code
uses: actions/checkout@v2
# 서버로 SSH 연결을 통한 배포
- name: Deploy to server via SSH
if: ${{secrets.SERVER_HOST && secrets.SERVER_USER && secrets.SERVER_SSH_KEY}} # Secret이 존재할 때만 실행

Check failure on line 20 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / Deploy to Server

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 20, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.SERVER_HOST && secrets.SERVER_USER && secrets.SERVER_SSH_KEY .github/workflows/main.yml (Line: 33, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.SERVER_HOST == null || secrets.SERVER_USER == null || secrets.SERVER_SSH_KEY == null
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd ./ArWebAuth/
git pull origin master
npm install
pm2 restart www
- name: Skip deployment in fork
if: ${{secrets.SERVER_HOST == null || secrets.SERVER_USER == null || secrets.SERVER_SSH_KEY == null}}
run: echo "Secrets not found. Skipping deployment."