Skip to content

Merge pull request #144 from hehysh/patch-2 #33

Merge pull request #144 from hehysh/patch-2

Merge pull request #144 from hehysh/patch-2 #33

Workflow file for this run

name: 'Build & Validate OPML file'
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install lxml beautifulsoup4
- name: Build Opml
env:
OPML_TITLE: "TUNA Blogroll"
run: |
.build/buildOpml.sh > opml.xml
.build/validator.py opml.xml || true
- name: Publish Opml
if: ${{ github.ref == 'refs/heads/master' }}
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REPO: ${{ github.repository }}
REMOTE_BRANCH: gh-pages
run: |
remote_repo="https://x-access-token:${GITHUB_ACCESS_TOKEN}@github.com/${GITHUB_REPO}.git"
git_commit_id=$(git rev-parse --short HEAD)
mkdir _site_remote && cd _site_remote
git init -b master
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote add origin $remote_repo
git pull origin $REMOTE_BRANCH
git rm -rf .
git clean -fxd
cp -a ../opml.xml ./
git add .
git commit --allow-empty -m "Github Action auto build for https://github.com/${GITHUB_REPO}/commit/${git_commit_id}"
git push -u origin master:$REMOTE_BRANCH