This commit is contained in:
parent
db0c3490e1
commit
92510eb8d3
3 changed files with 77 additions and 22 deletions
|
@ -1,27 +1,55 @@
|
|||
name: Auto Pull
|
||||
name: publish
|
||||
|
||||
on: [push]
|
||||
# push:
|
||||
# branches:
|
||||
# - 'main'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
steps:
|
||||
# - run: apt update && apt install -y openssh-client git hugo rsync
|
||||
- name: SSH Deploy
|
||||
#run: apt update && apt install -y openssh-client git hugo rsync
|
||||
uses: https://github.com/appleboy/ssh-action@v1
|
||||
#
|
||||
- uses: https://forge.melm.xyz/melmco/checkout@v4
|
||||
with:
|
||||
host: ${{ secrets.HOST_ADDRESS }}
|
||||
username: forgejo #$ {{ secrets.SSH_USER }} #
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
script: |
|
||||
ls
|
||||
cd Homepage
|
||||
git fetch
|
||||
git reset --hard HEAD
|
||||
git merge '@{u}'
|
||||
hugo && rsync -Oavz --no-p --delete public/ /var/www/melm.xyz
|
||||
submodules: recursive
|
||||
fetch-depth: 0 # all history for all branches and tags\
|
||||
|
||||
- uses: https://forge.melm.xyz/melmco/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go
|
||||
key: ${{ runner.os }}-go-
|
||||
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '>=1.21.0'
|
||||
|
||||
- name: Install Hugo
|
||||
run: |
|
||||
go install -tags extended github.com/gohugoio/hugo@0.140.2
|
||||
|
||||
- uses: https://forge.melm.xyz/melmco/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
hugo --minify
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
eval $(ssh-agent -s)
|
||||
echo "$SSH_PRIVATE_KEY" | ssh-add -
|
||||
apt update && apt install -y rsync
|
||||
mkdir ~/.ssh
|
||||
ssh-keyscan your-host.com > ~/.ssh/known_hosts
|
||||
rsync -atv --progress ./public/ forgejo@192.168.1.145:/var/www/melm.xyz
|
||||
|
|
27
.forgejo/workflows/deploy.yml.bak
Normal file
27
.forgejo/workflows/deploy.yml.bak
Normal file
|
@ -0,0 +1,27 @@
|
|||
name: Auto Pull
|
||||
|
||||
on: [push]
|
||||
# push:
|
||||
# branches:
|
||||
# - 'main'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
steps:
|
||||
# - run: apt update && apt install -y openssh-client git hugo rsync
|
||||
- name: SSH Deploy
|
||||
#run: apt update && apt install -y openssh-client git hugo rsync
|
||||
uses: https://github.com/appleboy/ssh-action@v1
|
||||
#
|
||||
with:
|
||||
host: ${{ secrets.HOST_ADDRESS }}
|
||||
username: forgejo #$ {{ secrets.SSH_USER }} #
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
script: |
|
||||
ls
|
||||
cd Homepage
|
||||
git fetch
|
||||
git reset --hard HEAD
|
||||
git merge '@{u}'
|
||||
hugo && rsync -Oavz --no-p --delete public/ /var/www/melm.xyz
|
BIN
public/.index.html.kate-swp
Normal file
BIN
public/.index.html.kate-swp
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue