name: Build G365SFU on: push: branches: [ main ] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: Install Node.js run: | if command -v apt-get &> /dev/null; then sudo apt-get update && sudo apt-get install -y nodejs npm elif command -v brew &> /dev/null; then brew install node fi - name: Checkout code uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v4 with: go-version: 1.20 - name: Build G365SFU run: | make build - name: Deploy to server via SSH uses: appleboy/scp-action@v1 with: host: ${{ secrets.SFU_SSH_HOST }} username: ${{ secrets.SFU_SSH_USER }} password: ${{ secrets.SFU_SSH_PASSWORD }} port: ${{ secrets.SFU_SSH_PORT }} source: "build/*" target: ${{ secrets.SFU_DEPLOY_PATH }} strip_components: 1 rm: false debug: true flatten: true - name: Restart Docker containers uses: appleboy/ssh-action@v1.2.5 with: host: ${{ secrets.SFU_SSH_HOST }} username: ${{ secrets.SFU_SSH_USER }} password: ${{ secrets.SFU_SSH_PASSWORD }} port: ${{ secrets.SFU_SSH_PORT }} script: | cd ${{ secrets.SFU_DEPLOY_PATH }} docker-compose down docker compose up -d --build