Files
illustrated-algorithm/.gitea/workflows/deploy.yaml
T
枫 716dca7663
Deploy / deploy (push) Failing after 2s
fix: clean clone dir before checkout
2026-08-23 14:43:17 +00:00

46 lines
1.2 KiB
YAML

name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: aliyun
steps:
- name: Install Docker CLI
run: |
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
apk add --no-cache docker-cli
- name: Checkout
run: |
rm -rf /tmp/illustrated-algorithm
git clone --depth 1 -b main \
http://47.121.181.112:3000/wonder/illustrated-algorithm.git \
/tmp/illustrated-algorithm
- name: Generate Navigation
run: sh /tmp/illustrated-algorithm/generate-nav.sh /tmp/illustrated-algorithm
- name: Build Docker Image
run: |
docker build \
--cache-from illustrated-algorithm:latest \
-t illustrated-algorithm:latest \
/tmp/illustrated-algorithm
- name: Deploy Container
run: |
docker stop illustrated-algorithm 2>/dev/null || true
docker rm illustrated-algorithm 2>/dev/null || true
docker run -d \
--name illustrated-algorithm \
--restart unless-stopped \
-p 10000:80 \
illustrated-algorithm:latest
- name: Cleanup Dangling Images
run: docker image prune -f