Maxime Delporte 51ea013bc3
All checks were successful
Deploying Website / build (push) Successful in 16s
first commit
2025-04-04 18:47:44 -03:00

42 lines
1.2 KiB
YAML

name: Deploying Website
run-name: ${{ gitea.actor }} is testing out Deploying Website
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Updating apt get
run: apt-get update -y
- name: Install rsync
run: apt-get install rsync -y
- name: Install Hugo
run: apt-get install hugo -y
- name: Clone the repository
uses: actions/checkout@v4
- name: Create the public directory
run: mkdir /public /hugo_cache
- name: Build the website
run: hugo --minify
- name: Add host key to known_hosts
run: |
mkdir -p ~/.ssh
echo "${{ secrets.RUNNER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p ${{ secrets.SERVER_PORT }} -H ${{ secrets.SERVER_IP}} >> ~/.ssh/known_hosts
- name: Test SSH connection
run: ssh -v -p ${{ secrets.SERVER_PORT }} -i ~/.ssh/id_rsa ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} 'echo "SSH connection successful"'
- name: Deploy to server
run: |
rsync -avz -e 'ssh -p ${{ secrets.SERVER_PORT }}' --delete public/ ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/var/www/acme-corporation.hstr.fr