working read write refactor #4
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 Dev | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- opw-testing | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Tailscale VPN | |
uses: tailscale/github-action@v2 | |
with: | |
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
tags: tag:ci | |
- name: Create SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519 | |
# Ping loop | |
host="${{ vars.TESTING_SERVER }}" | |
count=0 | |
max_attempts=30 | |
while ! ping -c 1 -W 1 $host > /dev/null 2>&1; do | |
count=$((count+1)) | |
echo "Attempt $count: Ping to $host failed, retrying..." | |
if [ $count -ge $max_attempts ]; then | |
echo "Failed to reach $host after $max_attempts attempts, stopping." | |
exit 1 | |
fi | |
sleep 1 | |
done | |
echo "Ping to $host successful." | |
ssh-keyscan -H ${{ vars.TESTING_SERVER }} >> ~/.ssh/known_hosts | |
shell: bash | |
- name: Clone & Install | |
run: | | |
ssh ${{ vars.TESTING_USER }}@${{ vars.TESTING_SERVER }} 'cd /opt/odoo/odoo17-addons; git pull; sudo systemctl restart odoo' | |
shell: bash |