This commit is contained in:
parent
fe014727f1
commit
890e2d528b
42
.gitea/workflows/deploy.yml
Normal file
42
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,42 @@
|
||||
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 update && apt upgrade -y
|
||||
|
||||
- name: Install rsync
|
||||
run: apt install rsync -y
|
||||
|
||||
- name: Install Hugo
|
||||
run: apt 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/todo.hstr.fr
|
Loading…
x
Reference in New Issue
Block a user