41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
name: Deploy on webserver
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- published
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build site and deploy on success
|
|
runs-on: trr379-www-deposit
|
|
container:
|
|
volumes:
|
|
# for depositing the built site directly
|
|
- /home/www/srv:/www:rw
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
|
|
with:
|
|
recursive: true
|
|
get_content: .
|
|
|
|
- name: Setup Hugo
|
|
uses: https://github.com/peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: '0.152.2'
|
|
extended: true
|
|
|
|
- name: Generate site
|
|
run: hugo --minify
|
|
|
|
- name: Deploy official site
|
|
if: ${{ github.ref_name == 'published' }}
|
|
run: cp -r public /www/new_www.trr379.de && mv /www/www.trr379.de /www/old_www.trr379.de; mv /www/new_www.trr379.de /www/www.trr379.de; rm -rf /www/old_www.trr379.de/
|
|
|
|
- name: Deploy draft site
|
|
if: ${{ github.ref_name == 'main' }}
|
|
run: cp -r public /www/new_www-draft.trr379.de && mv /www/www-draft.trr379.de /www/old_www-draft.trr379.de; mv /www/new_www-draft.trr379.de /www/www-draft.trr379.de; rm -rf /www/old_www-draft.trr379.de/
|