Деплой через Actions
This commit is contained in:
parent
8d3fbac5e3
commit
8622eee192
46
.gitea/workflows/build-and-deploy.yaml
Normal file
46
.gitea/workflows/build-and-deploy.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
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 ~/.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/
|
Loading…
Reference in New Issue
Block a user