schuelerzeitung/.gitea/workflows/prod.yml

59 lines
1.5 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:
2023-12-30 22:08:16 +01:00
working-directory: /opt/runner/workdir/schuelerzeitung-main
2023-10-21 21:10:05 +02:00
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-12-30 22:08:16 +01:00
- name: Pull
2023-10-21 13:52:17 +02:00
run: |
git fetch --all
git reset --hard origin/main
2023-12-30 22:08:16 +01: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-12-30 22:08:16 +01:00
- name: Deploy
2023-03-26 15:44:45 +02:00
run: |
2023-10-21 21:10:05 +02:00
cd public
2023-12-30 22:12:21 +01:00
rsync -azr --delete ./ /opt/data/webdata/schuelerzeitung/
2023-12-30 22:08:16 +01:00
- name: Telegram 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 }}
2023-12-30 22:08:16 +01:00
- name: Discord notification
2023-12-30 22:09:25 +01:00
uses: https://github.com/PingChunChung/actions-discord-notifier@main
2023-12-30 22:11:51 +01:00
if: always()
2023-12-30 22:08:16 +01:00
with:
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
2023-03-26 15:44:45 +02:00
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/