Skip to content

Build

Build #184

Workflow file for this run

name: Build
permissions:
contents: write
on:
schedule:
- cron: 0 4 * * * # 4:00 UTC everyday
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: get site-packages path
id: site_packages
run: echo "site_dir=$(python -c 'import site; print(site.getsitepackages()[0])')" > "$GITHUB_OUTPUT"
- name: cache installed packages
uses: actions/cache@v4
with:
path: ${{ steps.site_packages.outputs.site_dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: execute py script
run: python cngal-calendar.py
- name: check release changes
id: check_changes
run: if [[ $(git diff --name-only HEAD) == *"output/cngal-release.txt"* ]]; then echo "changes=true" > "$GITHUB_OUTPUT"; else echo "changes=false" > "$GITHUB_OUTPUT"; fi
- name: commit files only if new release is available
if: ${{ steps.check_changes.outputs.changes == 'true' }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "ics: update release calendar" -a
- name: push changes
if: ${{ steps.check_changes.outputs.changes == 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main