www/.forgejo/workflows/release.yml

73 lines
2.1 KiB
YAML
Raw Normal View History

2025-03-01 20:06:36 +01:00
name: Release website
on:
schedule:
- cron: "0 4 * * *"
push:
branches:
- staging
- production
pull_request:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
- name: Build pages
run: hugo $(cat .hugo-params)
- name: Add de_DE.UTF-8 locale
run: |
sudo apt-get update
sudo apt-get -y install locales
sudo locale-gen de_DE.UTF-8
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Generate calendars
run: python tools/merge_cals.py
- name: Copy calendar to output dir
run: cp static/all.ics public/all.ics
- name: Update homepage with latest event
run: upcoming="$(python tools/gen_upcoming.py static/all.ics 20 5 | tr '\n' ' ')" && sed -i "s#CALENDAR#$upcoming#g" public/index.html
- name: Generate timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H%M%SZ')" >> $GITHUB_ENV
- name: Create Release Archive
uses: thedoctor0/zip-release@0.7.6
with:
type: zip
filename: ../release-${{ github.ref_name }}-${{ env.timestamp }}.zip
directory: public
- name: Create Release
uses: ncipollo/release-action@v1.16.0
with:
tag: ${{ github.ref_name }}-${{ env.timestamp }}
name: Website ${{ github.ref_name }} version ${{ env.timestamp }}
body: Website ${{ github.ref_name }} version ${{ env.timestamp }}
artifacts: release-${{ github.ref_name }}-${{ env.timestamp }}.zip
token: ${{ secrets.GITEA_TOKEN }}