Files
website/.gitea/workflows/publish.yml
Workflow config file is invalid. Please check your config file: yaml: line 10: did not find expected key
Akshay a59cd1f62a idk
2025-07-23 14:39:12 -04:00

72 lines
2.6 KiB
YAML

# .gitea/workflows/publish.yml
name: Publish Website
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches: [ main ] # <- typo fixed (“braches” → “branches”)
jobs:
publish:
runs-on: ubuntu-22.04
# 1. Checkout the website repository (your app code)
# ------------------------------------------------------------
- name: Checkout website repo
run: git clone http://gitea:3000/lepton/website
# ------------------------------------------------------------
# 2. Start an SSH agent and load the private key from secrets
# ------------------------------------------------------------
- name: Set up SSH agent
env:
SSH_KEY: ${{ secrets.ACCESS_KEY }} # your private key
shell: bash
run: |
eval "$(ssh-agent -s)"
echo "$SSH_KEY" >> ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
shasum -a 256 ~/.ssh/id_rsa
# ------------------------------------------------------------
# 3. Trust the Gitea host key (port 222)
# ------------------------------------------------------------
- name: Trust Gitea host key
shell: bash
run: |
mkdir -p ~/.ssh
ssh-keyscan -H gitea 2>/dev/null >> ~/.ssh/known_hosts
# ------------------------------------------------------------
# 4. Clone the template repo via SSH (uses detected IP + port 222)
# ------------------------------------------------------------
- name: Clone template repo
shell: bash
run: |
git clone ssh://git@gitea/lepton/app_templates /tmp/template
# ------------------------------------------------------------
# 5. Copy Docker artefacts into workspace root
# ------------------------------------------------------------
- name: Copy Docker configuration
shell: bash
run: |
cp /tmp/template/web/docker-compose.yml ./website/docker-compose.yml
cp /tmp/template/web/Dockerfile ./website/Dockerfile
# ------------------------------------------------------------
# 6. Stop any old stack, rebuild, and run the new one
# ------------------------------------------------------------
- name: Stop existing stack (ignore if none)
shell: bash
run: |
cd ./website
docker compose down --remove-orphans || true
- name: Rebuild & deploy
shell: bash
working-directory: website
run: |
docker compose build --no-cache
docker compose up -d