This commit is contained in:
parent
b749156e3c
commit
63a26b69b7
2 changed files with 20 additions and 28 deletions
|
@ -1,34 +1,26 @@
|
||||||
name: Hugo
|
name: Hugo
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: hugo-latest
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Grab packages
|
||||||
with:
|
run: apk add rsync openssh-client
|
||||||
submodules: 'recursive'
|
- uses: actions/checkout@v4
|
||||||
- name: Add key
|
with:
|
||||||
run: |
|
submodules: 'true'
|
||||||
mkdir $HOME/.ssh && \
|
- name: Run build task
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $HOME/.ssh/id_rsa
|
run: hugo --minify
|
||||||
- name: Grab packages
|
- name: Test static page
|
||||||
run: |
|
run: bash ${{ gitea.workspace }}/bin/test_static_page.sh
|
||||||
apt-get update && \
|
- name: Deploy to Server
|
||||||
apt-get install -y jq rsync tar wget && \
|
uses: easingthemes/ssh-deploy@main
|
||||||
wget https://github.com/gohugoio/hugo/releases/download/v0.123.6/hugo_extended_0.123.6_linux-amd64.tar.gz && \
|
env:
|
||||||
tar -xzvf hugo_extended_0.123.6_linux-amd64.tar.gz && \
|
|
||||||
chmod +x hugo
|
|
||||||
- name: Run build task
|
|
||||||
run: ./hugo --minify --logLevel info
|
|
||||||
- name: Test static page
|
|
||||||
run: bash ${{ gitea.workspace }}/bin/test_static_page.sh
|
|
||||||
- name: Deploy to Server
|
|
||||||
uses: easingthemes/ssh-deploy@main
|
|
||||||
env:
|
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
ARGS: "-rlgoDzvc -i --delete"
|
ARGS: "-rlgoDzvc -i --delete"
|
||||||
SOURCE: "public/"
|
SOURCE: "public/"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
PORT=8080
|
|
||||||
python3 -m http.server $PORT --directory public/ &
|
|
||||||
|
|
||||||
|
PORT=21300
|
||||||
|
python3 -m http.server $PORT --directory public/ &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
|
|
||||||
# Give it a moment to start
|
# Give it a moment to start
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Check if the server is running
|
# Check if the server is running
|
||||||
if ! ps -p $SERVER_PID > /dev/null; then
|
if [ ! -d "/proc/$SERVER_PID" ]; then
|
||||||
echo "HTTP server failed to start."
|
echo "HTTP server failed to start."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue