Merge branch 'inventory-wizard-sort' into opw-testing #273
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 Testing | |
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 | |
version: 1.70.0 | |
- name: Wait for Tailscale | |
run: | | |
# 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." | |
shell: bash | |
- name: Create SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519 | |
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/odoo-addons; sudo -u odoo git pull; sudo systemctl restart odoo' | |
shell: bash | |
- name: Check if website is up | |
run: | | |
count=0 | |
max_attempts=30 | |
while true; do | |
status_code=$(curl --write-out "%{http_code}\n" --silent --output /dev/null ${{ vars.TESTING_SERVER }}:8069 || echo "Curl failed") | |
if [ "$status_code" = "200" ]; then | |
break | |
else | |
count=$((count+1)) | |
if [ $count -ge $max_attempts ]; then | |
exit 1 | |
fi | |
sleep 5 | |
fi | |
done | |
shell: bash |