schuelerzeitung/.gitea/workflows/prod.yml

52 lines
1.3 KiB
YAML
Raw Normal View History

2023-10-21 13:52:17 +02:00
name: schuelerzeitung-prod
2023-03-26 15:44:45 +02:00
on:
push:
branches:
- main
2023-10-21 21:10:05 +02:00
defaults:
run:
working-directory: /opt/data/actions/schuelerzeitung-main
2023-03-26 15:44:45 +02:00
jobs:
prod-build:
2023-10-21 13:52:17 +02:00
if: gitea.repository == 'gcg/schuelerzeitung'
2023-03-26 15:44:45 +02:00
runs-on: act-runner-user
timeout-minutes: 5
steps:
2023-10-21 13:52:17 +02:00
- name: pull
run: |
git fetch --all
git reset --hard origin/main
2023-03-26 15:44:45 +02:00
- name: build
2023-10-21 13:52:17 +02:00
run: |
rm -rf public
2023-10-21 20:25:30 +02:00
hugo --minify --gc --baseURL "https://schuelerzeitung-gcg.de/"
2023-03-26 15:44:45 +02:00
- name: deploy
run: |
2023-10-21 21:10:05 +02:00
cd public
2023-03-26 15:44:45 +02:00
rsync -azr --delete ./ /opt/data/webdata/schuelerzeitung/
- name: notification
uses: actions/telegram-action@main
2023-03-26 15:44:45 +02:00
if: always()
with:
chat_id: ${{ secrets.TG_CHAT_ID }}
token: ${{ secrets.TG_TOKEN }}
test-build:
2023-10-21 13:52:17 +02:00
if: gitea.repository == 'gcg/schuelerzeitung'
2023-03-26 15:44:45 +02:00
runs-on: act-runner-user
timeout-minutes: 5
steps:
2023-10-21 13:52:17 +02:00
- name: pull
run: |
git fetch --all
git reset --hard origin/main
2023-03-26 15:44:45 +02:00
- name: build
2023-10-21 13:52:17 +02:00
run: |
rm -rf test
2023-10-21 20:25:30 +02:00
hugo --minify --gc --baseURL "https://test.schuelerzeitung-gcg.de/" --buildDrafts --buildFuture -d test
2023-03-26 15:44:45 +02:00
- name: deploy
run: |
2023-10-21 21:10:05 +02:00
cd test
2023-03-26 15:44:45 +02:00
rsync -azr --delete ./ /opt/data/webdata/schuelerzeitung-test/