2023-07-03 15:35:41 +02:00
|
|
|
name: Production
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: https://github.com/actions/checkout@v3
|
2023-07-03 15:52:32 +02:00
|
|
|
|
|
|
|
- name: Install hugo
|
2023-07-03 16:06:06 +02:00
|
|
|
run: |
|
|
|
|
apt-get update -y
|
|
|
|
apt-get install hugo -y
|
2023-07-03 15:50:20 +02:00
|
|
|
|
|
|
|
- name: Init submodules
|
|
|
|
run: git submodule update --init
|
2023-07-03 15:35:41 +02:00
|
|
|
|
|
|
|
- name: Check Hugo version
|
|
|
|
run: hugo version
|
|
|
|
|
|
|
|
- name: Build staging
|
|
|
|
run: hugo --gc --minify --buildDrafts -b https://blog.broillet.ch/
|
|
|
|
|
2023-07-03 16:36:08 +02:00
|
|
|
- name: Copy (scp) staging build to blog server
|
2023-07-03 16:36:38 +02:00
|
|
|
uses: https://github.com/garygrossgarten/github-action-scp@release
|
2023-07-03 15:35:41 +02:00
|
|
|
with:
|
2023-07-03 16:36:08 +02:00
|
|
|
local: 'public'
|
|
|
|
remote: /var/www/html/staging
|
2023-07-03 15:35:41 +02:00
|
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
2023-07-03 16:36:08 +02:00
|
|
|
username: 'root'
|
|
|
|
privateKey : ${{ secrets.SSH_KEY }}
|
|
|
|
rmRemote: true
|
|
|
|
dotfiles: true
|
2023-07-03 15:35:41 +02:00
|
|
|
|
|
|
|
- name: Build production
|
|
|
|
run: hugo --gc --minify -b https://blog.broillet.ch/
|
|
|
|
|
2023-07-03 16:36:08 +02:00
|
|
|
- name: Copy (scp) prod build to blog server
|
2023-07-03 16:36:38 +02:00
|
|
|
uses: https://github.com/garygrossgarten/github-action-scp@release
|
2023-07-03 15:35:41 +02:00
|
|
|
with:
|
2023-07-03 16:36:08 +02:00
|
|
|
local: 'public'
|
|
|
|
remote: /var/www/html/prod
|
2023-07-03 15:35:41 +02:00
|
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
2023-07-03 16:36:08 +02:00
|
|
|
username: 'root'
|
|
|
|
privateKey : ${{ secrets.SSH_KEY }}
|
|
|
|
rmRemote: true
|
|
|
|
dotfiles: true
|