Files
blog-data/.github/workflows/tgc.yml
T
2025-04-15 22:37:39 -04:00

94 lines
2.6 KiB
YAML

name: Telegram Channel Updater
on:
schedule:
- cron: '0 */2 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: ffmpeg chromium-browser
version: 1.0
- name: Install dependencies
run: |
set -xe
python -VV
python -m pip install tgc
yarn global add puppeteer-lottie-cli
- name: Checkout gh-pages
run: |
ls -lah
# Ensure gh-pages branch exists, and check it out
if ! git fetch --no-tags --depth=1 origin gh-pages; then
echo "Branch gh-pages does not exist. Creating branch"
git switch --orphan gh-pages
else
echo "Checking out remote gh-pages branch"
git switch gh-pages
fi
ls -lah
- name: Run tgc
env:
tgc_config: ${{ secrets.TGC_CONFIG }}
PYTHONUNBUFFERED: 1
run: tgc
- name: Zotero Download
env:
ZOTERO: ${{ secrets.ZOTERO_USERID }}
if: "${{ env.ZOTERO != '' }}"
run: |
rm -rf zotero.json
curl -L "https://api.zotero.org/users/${ZOTERO}/publications/items?linkwrap=1&order=date&sort=desc&start=0&include=data&limit=100" --output zotero.json
ls -lah
- name: Profile Readme Download
env:
REPO_NAME: ${{ github.repository }}
run: |
echo "$REPO_NAME"
USER=$(python -c "print('${REPO_NAME}'.split('/')[0])")
echo "$USER"
rm -rf profile-readme.md
if ! curl -L "https://raw.githubusercontent.com/${USER}/${USER}/main/README.md" --output profile-readme.md; then
echo "Failed to download readme."
fi
ls -lah
- uses: EndBug/add-and-commit@v7
with:
# Determines the way the action fills missing author name and email. Three options are available:
# - github_actor -> UserName <UserName@users.noreply.github.com>
# - user_info -> Your Display Name <your-actual@email.com>
# - github_actions -> github-actions <email associated with the github logo>
# Default: github_actor
default_author: github_actions
branch: gh-pages
branch_mode: create
# The message for the commit.
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: '[U] Update channel content'