mmote.ru/.gitea/workflows/build-and-deploy.yaml

52 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2024-04-26 15:37:10 +03:00
name: Build and deploy mmote.ru
on:
push:
branches:
- 'master'
2024-04-26 15:37:10 +03:00
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: |
2024-04-26 15:39:03 +03:00
mkdir -p ~/.ssh/
2024-04-26 15:37:10 +03:00
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
with:
lfs: true
2024-04-26 15:37:10 +03:00
- name: Insert commit data to sidebar
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "themes/mmotium/layouts/partials/sidebar.html"
find: "<!--commit-->"
replace: |
Последний коммит:
2024-04-26 15:44:09 +03:00
<a href="https://gitee.mmote.ru/MultiMote/mmote.ru/commit/${{gitea.sha}}">
2024-04-26 15:37:10 +03:00
${{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/