blog/.gitea/workflows/build.yaml

65 lines
1.5 KiB
YAML
Raw Normal View History

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:06:06 +02:00
- name: debug
2023-07-03 16:20:11 +02:00
run: |
ls -al .
ls -al public/
2023-07-03 16:06:06 +02:00
2023-07-03 15:35:41 +02:00
- 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 }}
2023-07-03 16:19:19 +02:00
source: 'public/*'
2023-07-03 16:21:24 +02:00
target: '/var/www/html/staging'
2023-07-03 16:06:06 +02:00
rm: true
strip_components: 1
2023-07-03 15:35:41 +02:00
- name: Build production
run: hugo --gc --minify -b https://blog.broillet.ch/
2023-07-03 16:06:06 +02:00
- name: debug
2023-07-03 16:20:11 +02:00
run: |
ls -al .
ls -al public/
2023-07-03 16:06:06 +02:00
2023-07-03 15:35:41 +02:00
- 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 }}
2023-07-03 16:19:19 +02:00
source: 'public/*'
2023-07-03 16:21:24 +02:00
target: '/var/www/html/prod'
2023-07-03 16:06:06 +02:00
rm: true
strip_components: 1