ricevimento 2023 luglio 05 #141
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
# 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 | |
env: | |
REGEX_INCLUDE: "\\.(pdf|link|txt|c|sh|py|gz|apkg)$" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build pdfs out of tex,md and various doc files | |
container: | |
image: ghcr.io/csunibo/build-image:latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Recursively compile tex files | |
run: rec "\.tex$" "xelatex -pdf" | |
- name: Recursively compile (doc|ppt)x? files | |
run: rec "\.(doc|ppt)x?$" "libreoffice --headless --convert-to pdf --outdir ." | |
- name: Recursively compile md files | |
run: rec "\.md$" /usr/bin/md2pdf | |
- name: Recursively compile xopp files | |
run: rec "\.xopp$" /usr/bin/xopp2pdf | |
- name: Generate static directory listing | |
run: statik -page /usr/share/page.gohtml -l -b "https://${{ github.event.repository.owner.name }}.github.io/${{ github.event.repository.name }}/" -i "$REGEX_INCLUDE" site | |
- name: Generate site artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: ./site | |
deploy: | |
name: Deploy to Github Pages | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download static site artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: site | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: site | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |