exchangemarket/.github/workflows/push-dappbundle.yml
Workflow config file is invalid. Please check your config file: yaml: line 58: could not find expected ':'

59 lines
2.2 KiB
YAML

- name: Install OpenSSH client (if needed)
run: |
if ! command -v ssh >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y openssh-client
fi
- name: Run remote script over SSH
env:
R_HOST: ${{ secrets.R_HOST }}
P_USERNAME: ${{ secrets.P_USERNAME }}
P_PASSWORD: ${{ secrets.P_PASSWORD }}
SSH_PORT: ${{ secrets.SSH_PORT }}
run: |
# If you must use password auth, install sshpass (prefer SSH keys in the long run)
if ! command -v sshpass >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y sshpass
fi
sshpass -p "$P_PASSWORD" ssh \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-p "$SSH_PORT" "$P_USERNAME@$R_HOST" bash -s <<'REMOTE'
set -euo pipefail
if [ -d "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle" ]; then
echo "Folder exists. Skipping Git clone."
else
echo "Folder does not exist. Cloning repository..."
cd "${{ secrets.DEPLOYMENT_LOCATION }}/" && git clone https://github.com/ranchimall/dappbundle.git
fi
cd "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle"
git config user.name "ranchimall-bot" || true
git config user.email "bot@ranchimall.net" || true
if [ -d "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle/${{ github.event.repository.name }}" ]; then
echo "Repository exists. Remove folder"
rm -rf "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle/${{ github.event.repository.name }}"
fi
echo "Cloning repository..."
cd "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle" && \
git clone --depth=1 "https://github.com/ranchimall/${{ github.event.repository.name }}"
cd "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle/${{ github.event.repository.name }}" && \
rm -rf .gitattributes .git .github .gitignore
cd "${{ secrets.DEPLOYMENT_LOCATION }}/dappbundle"
git add -A .
if git diff --cached --quiet; then
echo "No changes detected. Skipping commit and push."
else
git commit -m "Workflow updating files of ${{ github.event.repository.name }}"
git push "https://ranchimalldev:${{ secrets.RM_ACCESS_TOKEN }}@github.com/ranchimall/dappbundle.git"
fi
REMOTE