Skip to content

Commit

Permalink
ci: use actions to deploy github pages, remove obsolete file
Browse files Browse the repository at this point in the history
Signed-off-by: Shengqi Chen <[email protected]>
  • Loading branch information
Harry-Chen committed May 17, 2024
1 parent bbc04d0 commit 5668caa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 133 deletions.
107 changes: 0 additions & 107 deletions .build/validator.python2.bak

This file was deleted.

49 changes: 23 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: 'Build & Validate OPML file'

on: [push]
on: [push, pull_request]

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
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -24,25 +23,23 @@ jobs:
run: |
.build/buildOpml.sh > opml.xml
.build/validator.py opml.xml || true
- name: Publish Opml
- name: Upload Pages Artifact
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
uses: actions/upload-pages-artifact@v3
with:
path: opml.xml

deploy:
if: ${{ github.ref == 'refs/heads/master' }}
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 5668caa

Please sign in to comment.