64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
name: Production
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
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: debug
|
|
run: |
|
|
ls -al .
|
|
ls -al public/
|
|
|
|
- name: Copy (scp) staging build to blog server
|
|
uses: https://github.com/nicklasfrahm/scp-action@main
|
|
with:
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
|
username: root
|
|
port: 22
|
|
direction: upload
|
|
key: ${{ secrets.SSH_KEY }}
|
|
source: 'public/*'
|
|
target: '/var/www/html/staging'
|
|
|
|
- name: Build production
|
|
run: hugo --gc --minify -b https://blog.broillet.ch/
|
|
|
|
- name: debug
|
|
run: |
|
|
ls -al .
|
|
ls -al public/
|
|
|
|
- name: Copy (scp) staging build to blog server
|
|
uses: https://github.com/appleboy/scp-action@v0.1.4
|
|
with:
|
|
host: ${{ secrets.SSH_HOSTNAME }}
|
|
username: root
|
|
port: 22
|
|
key: ${{ secrets.SSH_KEY }}
|
|
source: 'public/*'
|
|
target: '/var/www/html/prod'
|
|
rm: true
|
|
strip_components: 1 |