Skip to content

Webscraping to Pages #271

Webscraping to Pages

Webscraping to Pages #271

Workflow file for this run

name: Webscraping to Pages
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 1 * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
scraper:
runs-on: ubuntu-latest
name: Run project
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: clippy
- uses: actions-rs/cargo@v1
with:
command: fix
- uses: actions-rs/cargo@v1
with:
command: fmt
- uses: actions-rs/cargo@v1
with:
command: run
args: --release
- name: Generate artifact
uses: actions/upload-artifact@v4
with:
name: courses
path: ./output/*.adoc
asciidoc:
name: Build web page
runs-on: ubuntu-latest
needs: scraper
container:
image: ghcr.io/csunibo/build-image:latest
steps:
- name: Download source artifact
uses: actions/download-artifact@v4
with:
name: courses
path: "."
- name: Generate HTML
run: asciidoctor "*.adoc"
- name: Generate PDF
run: asciidoctor-pdf "*.adoc"
- name: Generate site artifact
uses: actions/upload-artifact@v4
with:
name: site
path: "."
pages:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: https://${{ vars.GITHUB_REPOSITORY_OWNER }}.github.io/${{ github.event.repository.name }}
runs-on: ubuntu-latest
needs: asciidoc
if: github.ref == 'refs/heads/main'
steps:
- name: Download site artifact
uses: actions/download-artifact@v4
with:
name: site
path: site
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4