47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
name: Build and deploy mmote.ru
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build-And-Deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: '0.125.4'
|
|
extended: true
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
mkdir -p ~/.ssh/
|
|
echo "$HUGO_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
chmod 600 ~/.ssh/id_rsa
|
|
shell: bash
|
|
env:
|
|
HUGO_PRIVATE_KEY: ${{secrets.HUGO_PRIVATE_KEY}}
|
|
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}}
|
|
|
|
- name: Checkout repository code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Insert commit data to sidebar
|
|
uses: jacobtomlinson/gha-find-replace@v3
|
|
with:
|
|
include: "themes/mmotium/layouts/partials/sidebar.html"
|
|
find: "<!--commit-->"
|
|
replace: |
|
|
Последний коммит:
|
|
<a href="https://gitee.mmote.ru/MultiMote/mmote.ru/commit/${{gitea.sha}}">
|
|
${{gitea.event.head_commit.message}}
|
|
</a>
|
|
regex: false
|
|
|
|
- name: Hugo build
|
|
run: hugo
|
|
|
|
- name: Deploy files to server
|
|
run: |
|
|
ssh hugo@mserver.lan rm -rf /var/www/mmote.ru/public
|
|
scp -r public/ hugo@mserver.lan:/var/www/mmote.ru/
|