add publish frontend
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 11s
checks / Set up Java for Backend Tests and Build (pull_request) Successful in 13s
checks / Set up Java for Backend Tests and Build (push) Has been cancelled
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Has been cancelled
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 11s
checks / Set up Java for Backend Tests and Build (pull_request) Successful in 13s
checks / Set up Java for Backend Tests and Build (push) Has been cancelled
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Has been cancelled
This commit is contained in:
@ -78,6 +78,63 @@ jobs:
|
||||
yarn build
|
||||
#yarn test --watchAll=false --ci
|
||||
|
||||
# Ensure SSH and SCP are installed and functional
|
||||
- name: Setup SSH and SCP
|
||||
run: |
|
||||
set -e
|
||||
echo "Ensuring SSH and SCP are available..."
|
||||
if command -v apt >/dev/null 2>&1; then
|
||||
apt-get update -qq >/dev/null
|
||||
apt-get install -y -qq openssh-client >/dev/null
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add --no-cache openssh >/dev/null
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y -q openssh-clients >/dev/null
|
||||
else
|
||||
echo "No supported package manager found for SSH installation."
|
||||
exit 1
|
||||
fi
|
||||
echo "SSH and SCP successfully installed:"
|
||||
ssh -V
|
||||
scp -V || echo "SCP version info not available but command exists."
|
||||
|
||||
- name: Publish frontend .next build to server
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
SERVER_IP: ${{ vars.SERVER_IP }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
echo "vars.SERVER_IP: $vars.SERVER_IP"
|
||||
echo "vars.DOMAIN_NAME: $vars.DOMAIN_NAME"
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh -o StrictHostKeyChecking=no root@$SERVER_IP "mkdir -p /var/www/frontend"
|
||||
scp -o StrictHostKeyChecking=no -r frontend/.next root@$SERVER_IP:/var/www/frontend/
|
||||
echo "Frontend artifact copied successfully to $SERVER_IP:/var/www/frontend"
|
||||
|
||||
- name: Publish frontend .next build to Plesk server
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
SERVER_IP: ${{ vars.SERVER_IP }}
|
||||
DOMAIN_NAME: ${{ vars.DOMAIN_NAME }} # optional, helps locate vhost
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
echo "Deploying to server: $SERVER_IP"
|
||||
|
||||
#Define Plesk web root (update DOMAIN_NAME in Gitea variables)
|
||||
WEB_ROOT="/var/www/vhosts/${DOMAIN_NAME}/httpdocs"
|
||||
|
||||
ssh -o StrictHostKeyChecking=no root@$SERVER_IP "mkdir -p $WEB_ROOT/.next"
|
||||
ssh -o StrictHostKeyChecking=no root@$SERVER_IP "mkdir -p $WEB_ROOT/public/.htaccess"
|
||||
|
||||
#Copy only the .next build folder to the server
|
||||
scp -o StrictHostKeyChecking=no -r frontend/.next root@$SERVER_IP:$WEB_ROOT/
|
||||
|
||||
echo "Frontend .next build successfully deployed to $SERVER_IP:$WEB_ROOT/.next"
|
||||
|
||||
backend-jobs:
|
||||
name: Set up Java for Backend Tests and Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user