Files
website/.gitea/workflows/publish.yml
Akshay 524ab7989e
All checks were successful
Publish Website / publish (push) Successful in 28s
cleaned up actions script
2025-07-23 15:23:24 -04:00

55 lines
1.6 KiB
YAML

# .gitea/workflows/publish.yml
name: Publish Website
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-22.04
container:
image: docker:28.2
services:
docker:dind:
image: docker:28.2-dind
command: ["--storage-driver=overlay2", "--tls=false"]
steps:
- name: Checkout website repo
run: git clone http://gitea:3000/lepton/website
- name: Set up SSH agent
env:
SSH_KEY: ${{ secrets.ACCESS_KEY }}
run: |
eval "$(ssh-agent -s)"
mkdir ~/.ssh
echo "$SSH_KEY" >> ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
- name: Trust Gitea host key
run: |
ssh-keyscan -H gitea 2>/dev/null >> ~/.ssh/known_hosts
- name: Clone template repo
run: |
git clone ssh://git@gitea/lepton/app_templates /tmp/template
- name: Copy Docker configuration
run: |
cp /tmp/template/web/docker-compose.yml ./website/docker-compose.yml
cp /tmp/template/web/Dockerfile ./website/Dockerfile
- name: Stop existing stack (ignore if none)
run: |
cd ./website
docker compose down --remove-orphans || true
# Add this line to forcefully remove the container if it still exists
docker rm -f website || true # `|| true` to prevent step failure if container doesn't exist
- name: Rebuild & deploy
working-directory: website
run: |
docker compose build --no-cache
docker compose up -d