diff --git a/.gitea/workflows/build-and-deploy.yaml b/.gitea/workflows/build-and-deploy.yaml new file mode 100644 index 0000000..64f510e --- /dev/null +++ b/.gitea/workflows/build-and-deploy.yaml @@ -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: "" + replace: | + Последний коммит: + + ${{gitea.event.head_commit.message}} + + 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/