Files
omnivore/.github/workflows/static.yml
2023-02-10 13:02:05 +08:00

75 lines
1.9 KiB
YAML

# Simple workflow for generating and deploying static html in readability folder to GitHub Pages
name: Deploy static content to Pages
on:
push:
branches:
- main
paths-ignore:
- 'apple/**'
pull_request:
branches:
- main
paths-ignore:
- 'apple/**'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
generate-static:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Generate distiller output for readability
run: |
go install github.com/omnivore-app/go-domdistiller@latest
for f in packages/readabilityjs/test/test-pages/*; do
echo "Processing $f file..."
# skip newsletters for now
if [ "$f" = "packages/readabilityjs/test/test-pages/newsletters" ]; then
continue
fi
go-domdistiller file -i $f/source.html -o $f/distiller.html
done
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Generate static html
run: |
cd packages/readabilityjs/test
python generate_static.py
deploy:
needs: generate-static
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'packages/readabilityjs/test/index.html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1