All checks were successful
Build and Deploy KVMote Landing Page / build (push) Successful in 34s
Build and Deploy n8ngo Landing Page / build (push) Successful in 47s
Build and Deploy KVMote Landing Page / deploy (push) Successful in 15s
Build and Deploy n8ngo Landing Page / deploy (push) Successful in 11s
Build and Deploy JobMaker / build (push) Successful in 41s
Build and Deploy JobMaker / deploy (push) Successful in 13s
Build and Deploy JobMaker / notify (push) Successful in 1s
- Add n8ngo/ and kvmote/ subfolders with Dockerfiles, nginx configs and static files - Add dedicated Gitea workflows for each landing page (ports 8084/8085) - Add paths-ignore to jobmaker workflow so it only triggers on its own files - Add .dockerignore to keep landing page folders out of jobmaker image Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
name: Build and Deploy KVMote Landing Page
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'kvmote/**'
|
|
- '.gitea/workflows/deploy-kvmote.yml'
|
|
|
|
env:
|
|
REGISTRY: registry.redecarneir.us
|
|
IMAGE_NAME: kvmote-landing
|
|
DEPLOY_HOST: 92.246.130.58
|
|
DEPLOY_USER: root
|
|
CONTAINER_NAME: kvmote-landing
|
|
CONTAINER_PORT: 8085
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Generate tags
|
|
id: meta
|
|
run: |
|
|
echo "LATEST_TAG=${REGISTRY}/${IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
|
|
echo "VERSION_TAG=${REGISTRY}/${IMAGE_NAME}:$(date +%Y%m%d)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build \
|
|
-t ${{ steps.meta.outputs.LATEST_TAG }} \
|
|
-t ${{ steps.meta.outputs.VERSION_TAG }} \
|
|
./kvmote
|
|
|
|
- name: Test container
|
|
run: |
|
|
docker run -d --name test-kvmote -p 8098:80 ${{ steps.meta.outputs.LATEST_TAG }}
|
|
sleep 5
|
|
docker exec test-kvmote wget -qO- http://localhost/ > /dev/null && echo "OK"
|
|
docker stop test-kvmote && docker rm test-kvmote
|
|
|
|
- name: Push to registry
|
|
run: |
|
|
docker push ${{ steps.meta.outputs.LATEST_TAG }}
|
|
docker push ${{ steps.meta.outputs.VERSION_TAG }}
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- name: Setup SSH
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H ${{ env.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
|
|
|
- name: Deploy to server
|
|
run: |
|
|
ssh ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }} << 'EOF'
|
|
set -e
|
|
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
docker stop ${{ env.CONTAINER_NAME }} || true
|
|
docker rm ${{ env.CONTAINER_NAME }} || true
|
|
docker run -d \
|
|
--name ${{ env.CONTAINER_NAME }} \
|
|
--restart unless-stopped \
|
|
-p ${{ env.CONTAINER_PORT }}:80 \
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
sleep 5
|
|
curl -f http://localhost:${{ env.CONTAINER_PORT }}/ || exit 1
|
|
docker image prune -f
|
|
echo "Deploy kvmote OK"
|
|
EOF
|
|
|
|
- name: Verify deployment
|
|
run: |
|
|
ssh ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }} << 'EOF'
|
|
docker ps | grep ${{ env.CONTAINER_NAME }}
|
|
docker logs --tail 10 ${{ env.CONTAINER_NAME }}
|
|
EOF
|