Add Forgejo actions
publish / publish (push) Failing after 45s Details

main
Marc Riera 2024-02-17 13:48:09 +01:00 committed by Marc Riera
parent fb4f0e17c4
commit e7e18ae174
2 changed files with 36 additions and 25 deletions

View File

@ -0,0 +1,36 @@
name: publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
env:
SSH_PRIVATE_KEY: ${{ secrets.PUBLISHER_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.PUBLISHER_HOST }}
SSH_PORT: ${{ secrets.PUBLISHER_PORT }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # all history for all branches and tags\
- name: Install Hugo
run: |
apt update && apt install -y hugo
- 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 -p $SSH_PORT $SSH_HOST > ~/.ssh/known_hosts
rsync -atv --progress --delete -e "ssh -p $SSH_PORT" ./public/ publisher@$SSH_HOST:/usr/share/nginx/html/

View File

@ -1,25 +0,0 @@
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apt-get update
- apt-get --yes install rsync
build:
stage: build
script:
- hugo
artifacts:
paths:
- public
only:
- master
deploy:
stage: deploy
script:
- rsync -hrv --delete public/ /var/opt/gitlab-runner/builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/
only:
- master