Skip to content

Update talks for 2026-02-04 #8

Update talks for 2026-02-04

Update talks for 2026-02-04 #8

name: Generate and Release Calendar
on:
push:
paths:
- 'calendar/cpp-aachen.jsoncal'
workflow_dispatch:
permissions:
contents: write
jobs:
generate-calendar:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install icalendar
- name: Download json2ical.py script
run: |
curl -o json2ical.py https://raw.githubusercontent.com/d-frey/json2ical/refs/heads/main/json2ical.py
chmod +x json2ical.py
- name: Generate iCal file
run: |
python json2ical.py calendar/cpp-aachen.jsoncal cpp-aachen.ics
- name: Get current timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
- name: Create or update latest release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const { owner, repo } = context.repo;
// Try to get existing "latest" release
let release;
try {
const existingRelease = await github.rest.repos.getReleaseByTag({
owner,
repo,
tag: 'latest'
});
release = existingRelease.data;
// Delete existing assets
const assets = await github.rest.repos.listReleaseAssets({
owner,
repo,
release_id: release.id
});
for (const asset of assets.data) {
await github.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id: asset.id
});
}
// Update release
await github.rest.repos.updateRelease({
owner,
repo,
release_id: release.id,
name: 'Latest Calendar Release',
body: `Automatically generated iCal calendar file from cpp-aachen.jsoncal\\n\\nGenerated on: ${new Date().toISOString()}\\n\\nThis release is automatically updated when the calendar file changes.`
});
} catch (error) {
if (error.status === 404) {
// Create new release if "latest" doesn't exist
const newRelease = await github.rest.repos.createRelease({
owner,
repo,
tag_name: 'latest',
name: 'Latest Calendar Release',
body: `Automatically generated iCal calendar file from cpp-aachen.jsoncal\\n\\nGenerated on: ${new Date().toISOString()}\\n\\nThis release is automatically updated when the calendar file changes.`,
draft: false,
prerelease: false
});
release = newRelease.data;
} else {
throw error;
}
}
// Upload the iCal file
const fileContent = fs.readFileSync('cpp-aachen.ics');
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release.id,
name: 'cpp-aachen.ics',
data: fileContent,
headers: {
'content-type': 'text/calendar'
}
});
core.info(`Successfully uploaded cpp-aachen.ics to release ${release.tag_name}`);