53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Production
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
container: ubuntu:22.04
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: https://github.com/actions/checkout@v3
|
|
|
|
- name: Install hugo
|
|
run: |
|
|
apt-get update -y
|
|
apt-get install hugo -y
|
|
|
|
- name: Init submodules
|
|
run: git submodule update --init
|
|
|
|
- name: Check Hugo version
|
|
run: hugo version
|
|
|
|
- name: Build staging
|
|
run: hugo --gc --minify --buildDrafts -b https://blog.broillet.ch/
|
|
|
|
- name: Copy (scp) staging build to blog server
|
|
uses: https://github.com/garygrossgarten/github-action-scp@release
|
|
with:
|
|
local: 'public'
|
|
remote: /var/www/html/staging
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
|
username: 'root'
|
|
privateKey : ${{ secrets.SSH_KEY }}
|
|
rmRemote: true
|
|
dotfiles: true
|
|
|
|
- name: Build production
|
|
run: hugo --gc --minify -b https://blog.broillet.ch/
|
|
|
|
- name: Copy (scp) prod build to blog server
|
|
uses: https://github.com/garygrossgarten/github-action-scp@release
|
|
with:
|
|
local: 'public'
|
|
remote: /var/www/html/prod
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
|
username: 'root'
|
|
privateKey : ${{ secrets.SSH_KEY }}
|
|
rmRemote: true
|
|
dotfiles: true |