Update ics files #255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy iCalendar files | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '22' | |
- name: grab old events | |
run: | | |
git fetch origin gh-pages | |
git cat-file blob origin/gh-pages:./events.json >./events-prev.json | |
yesterdaycommit=$(git log origin/gh-pages --until=yesterday --pretty=tformat:%H | head -1) | |
git cat-file blob "$yesterdaycommit":./events.json >./events-yesterday.json | |
- name: create directories | |
run: | | |
mkdir -p build | |
mkdir -p ical/{cours,groupes,profs,salles} | |
- name: install deps | |
run: | | |
npm install | |
- name: create events.json | |
run: | | |
node scripts/getEvents.mjs -d export-cours/ >build/events.json | |
- name: generate config and ics files | |
run: | | |
node scripts/generate-ics-and-config-file.mjs ical/ build/events.json build/calendars.json | |
mv -t build ical | |
- name: generate freeevents.json | |
run: | | |
npx tsc scripts/freerooms.ts | |
node scripts/freerooms.js ./build/events.json > build/freeevents.json | |
- name: generate index.html | |
run: | | |
exec >build/index.html | |
{ printf '<p>Last update: <time>%s</time></p>' "$(TZ=Europe/Brussels date)"; } | |
echo "<h2>Depuis dernière publication</h2>" | |
echo "<pre>" | |
node scripts/diffevents.mjs events-prev.json build/events.json | |
echo "</pre>" | |
echo "<h2>Depuis hier</h2>" | |
echo "<pre>" | |
node scripts/diffevents.mjs events-yesterday.json build/events.json | |
echo "</pre>" | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: build # The folder the action should deploy. |