Actions update 9
This commit is contained in:
@@ -10,9 +10,19 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout website repo
|
# Step 0: Detect Docker host IP (works inside containers)
|
||||||
run: git clone https://code.akshaykolli.net/lepton/website
|
- name: Detect Gitea host IP
|
||||||
|
id: host_ip
|
||||||
|
run: |
|
||||||
|
HOST_IP=$(ip route | grep default | awk '{print $3}')
|
||||||
|
echo "GITEA_HOST=$HOST_IP" >> $GITHUB_ENV
|
||||||
|
echo "Detected Gitea host IP: $HOST_IP"
|
||||||
|
|
||||||
|
# Clone the website repo over HTTPS
|
||||||
|
- name: Checkout website repo
|
||||||
|
run: git clone https://code.akshaykolli.net/lepton/website .
|
||||||
|
|
||||||
|
# Setup SSH agent with secret key
|
||||||
- name: Set up SSH agent
|
- name: Set up SSH agent
|
||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.ACCESS_KEY }}
|
SSH_KEY: ${{ secrets.ACCESS_KEY }}
|
||||||
@@ -21,26 +31,31 @@ jobs:
|
|||||||
echo "$SSH_KEY" | tr -d '\r' | ssh-add -
|
echo "$SSH_KEY" | tr -d '\r' | ssh-add -
|
||||||
ssh-add -l
|
ssh-add -l
|
||||||
|
|
||||||
- name: Check if Gitea SSH is alive
|
# Trust Gitea host's SSH key
|
||||||
run: ssh -p 222 git@localhost
|
|
||||||
|
|
||||||
- name: Trust Gitea host
|
- name: Trust Gitea host
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
ssh-keyscan -H -p 222 localhost 2>/dev/null >> ~/.ssh/known_hosts
|
ssh-keyscan -H -p 222 $GITEA_HOST 2>/dev/null >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
# Optional: Debug SSH connection
|
||||||
|
- name: Check if Gitea SSH is alive
|
||||||
|
run: ssh -p 222 git@$GITEA_HOST || echo "Warning: SSH connection failed but continuing..."
|
||||||
|
|
||||||
|
# Clone template repo via SSH
|
||||||
- name: Clone template repo
|
- name: Clone template repo
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 ssh://git@localhost:222/lepton/app_templates /tmp/template
|
git clone --depth 1 ssh://git@$GITEA_HOST:222/lepton/app_templates /tmp/template
|
||||||
|
|
||||||
|
# Copy Docker configuration files
|
||||||
- name: Copy Docker configuration
|
- name: Copy Docker configuration
|
||||||
run: |
|
run: |
|
||||||
cp /tmp/template/web/docker-compose.yml .
|
cp /tmp/template/web/docker-compose.yml .
|
||||||
cp /tmp/template/web/Dockerfile .
|
cp /tmp/template/web/Dockerfile .
|
||||||
|
|
||||||
|
# Tear down any old deployment
|
||||||
- name: Stop existing stack
|
- name: Stop existing stack
|
||||||
run: docker compose down --remove-orphans || true
|
run: docker compose down --remove-orphans || true
|
||||||
|
|
||||||
|
# Rebuild and start fresh
|
||||||
- name: Rebuild and deploy
|
- name: Rebuild and deploy
|
||||||
run: docker compose up -d --build
|
run: docker compose up -d --build
|
||||||
|
Reference in New Issue
Block a user