From ae7f79e51669c43f2c714e548b07657fefcc940b Mon Sep 17 00:00:00 2001 From: VaiTon Date: Wed, 5 Jul 2023 00:26:49 +0200 Subject: [PATCH] Workflow condiviso + rimossi file inutilizzati --- .github/workflows/build-and-deploy.yml | 110 +------------------ .github/workflows/build-and-deploy.yml.orig | 115 -------------------- .github/workflows/build-and-deploy.yml.rej | 83 -------------- .github/workflows/md2pdf | 3 - .github/workflows/page.gohtml | 38 ------- .github/workflows/rec | 11 -- 6 files changed, 6 insertions(+), 354 deletions(-) delete mode 100644 .github/workflows/build-and-deploy.yml.orig delete mode 100644 .github/workflows/build-and-deploy.yml.rej delete mode 100755 .github/workflows/md2pdf delete mode 100644 .github/workflows/page.gohtml delete mode 100755 .github/workflows/rec diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index bb412ce..f43c5ea 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -1,113 +1,15 @@ name: Build and Deploy on: push: - branches: main + branches: [main] pull_request: - branches: main + 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)$" - jobs: - build: - name: Build pdfs out of tex,md and various doc files - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - - name: Install tex - run: | - sudo apt update - sudo apt install texlive-latex-extra texlive-lang-italian texlive-lang-english texlive-fonts-recommended texlive-bibtex-extra texlive-science texlive-xetex - - - name: Install format conversion tools - run: | - sudo apt install libreoffice - wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-linux-amd64.tar.gz -O /tmp/pandoc.tar.gz - tar xfz /tmp/pandoc.tar.gz -C /tmp - sudo mv /tmp/pandoc-*/bin/* /usr/bin - - - name: Recursively compile tex files - run: ./.github/workflows/rec "*\.tex$" "xelatex -pdf" - - - name: Recursively compile (doc|ppt)x? files - run: ./.github/workflows/rec "*\.((doc|ppt)x?)|odt$" "libreoffice --headless --convert-to pdf --outdir ." - - - name: Recursively compile md files - run: ./.github/workflows/rec "*\.md$" ${GITHUB_WORKSPACE}/.github/workflows/md2pdf - - - name: Generate build artifact - uses: actions/upload-artifact@v2 - with: - name: build-result - path: . - - statik: - name: Generate the static listing - runs-on: ubuntu-latest - needs: build - steps: - - name: Download compiled files - uses: actions/download-artifact@v2 - with: - name: build-result - - - name: Install go - uses: actions/setup-go@v3 - with: - go-version: ">=1.18.0" - - - name: Install statik - run: go install github.com/lucat1/statik@latest - - - name: Update packages and install rsync - run: sudo apt install rsync - - - name: Generate static directory listing - run: $(go env GOPATH)/bin/statik -page .github/workflows/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@v2 - with: - name: statik-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 + name: Deploy + uses: csunibo/config/.github/workflows/statik.yml@main + with: + regex_include: "\\.(pdf|link|txt|sh)$" diff --git a/.github/workflows/build-and-deploy.yml.orig b/.github/workflows/build-and-deploy.yml.orig deleted file mode 100644 index 7a1220e..0000000 --- a/.github/workflows/build-and-deploy.yml.orig +++ /dev/null @@ -1,115 +0,0 @@ -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)$" - -jobs: - build: - name: Build pdfs out of tex,md and various doc files - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - - name: Install tex - run: | - sudo apt update - sudo apt install texlive-latex-extra texlive-lang-italian texlive-lang-english texlive-fonts-recommended texlive-bibtex-extra texlive-science texlive-xetex - - - name: Install format conversion tools - run: | - sudo apt install libreoffice - wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-linux-amd64.tar.gz -O /tmp/pandoc.tar.gz - tar xfz /tmp/pandoc.tar.gz -C /tmp - sudo mv /tmp/pandoc-*/bin/* /usr/bin - - - name: Recursively compile tex files - run: ./.github/workflows/rec "*\.tex$" "xelatex -pdf" - - - name: Recursively compile (doc|ppt)x? files - run: ./.github/workflows/rec "*\.((doc|ppt)x?)|odt$" "libreoffice --headless --convert-to pdf --outdir ." - - - name: Recursively compile md files - run: ./.github/workflows/rec "*\.md$" ${GITHUB_WORKSPACE}/.github/workflows/md2pdf - - - name: Generate build artifact - uses: actions/upload-artifact@v2 - with: - name: build-result - path: . - - statik: - name: Generate the static listing - runs-on: ubuntu-latest - needs: build - steps: - - name: Download compiled files - uses: actions/download-artifact@v2 - with: - name: build-result - - - name: Install go - uses: actions/setup-go@v3 - with: - go-version: ">=1.18.0" - - - name: Install statik - run: go install github.com/lucat1/statik@latest - - - name: Update packages and install rsync - run: sudo apt install rsync - - - name: Generate static directory listing - run: $(go env GOPATH)/bin/statik -page .github/workflows/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@v2 - with: - name: statik-build - path: ./site - - deploy: - name: Deploy to Github Pages - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: statik - if: github.ref == 'refs/heads/main' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Download static site artifact - uses: actions/download-artifact@v2 - with: - name: statik-build - path: site - - name: Setup Pages - uses: actions/configure-pages@v1 - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - with: - path: site - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@main diff --git a/.github/workflows/build-and-deploy.yml.rej b/.github/workflows/build-and-deploy.yml.rej deleted file mode 100644 index 31aec47..0000000 --- a/.github/workflows/build-and-deploy.yml.rej +++ /dev/null @@ -1,83 +0,0 @@ ---- .github/workflows/build-and-deploy.yml -+++ .github/workflows/build-and-deploy.yml -@@ -23,69 +23,35 @@ env: - - jobs: - build: -- name: Build pdfs out of tex,md and various doc files - 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: Install tex -- run: | -- sudo apt update -- sudo apt install texlive-latex-extra texlive-lang-italian texlive-lang-english texlive-fonts-recommended texlive-bibtex-extra texlive-science texlive-xetex -- -- - name: Install format conversion tools -- run: | -- sudo apt install libreoffice -- wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-linux-amd64.tar.gz -O /tmp/pandoc.tar.gz -- tar xfz /tmp/pandoc.tar.gz -C /tmp -- sudo mv /tmp/pandoc-*/bin/* /usr/bin -- - - name: Recursively compile tex files -- run: ./.github/workflows/rec "*\.tex$" "xelatex -pdf" -+ run: rec "\.tex$" "xelatex -pdf" - - - name: Recursively compile (doc|ppt)x? files -- run: ./.github/workflows/rec "*\.(doc|ppt)x?$" "libreoffice --headless --convert-to pdf --outdir ." -+ run: rec "\.(((doc|ppt)x?)|od(t|p))$" "libreoffice --headless --convert-to pdf --outdir ." - - - name: Recursively compile md files -- run: ./.github/workflows/rec "*\.md$" ${GITHUB_WORKSPACE}/.github/workflows/md2pdf -+ run: rec "\.md$" /usr/bin/md2pdf - -- - name: Generate build artifact -- uses: actions/upload-artifact@v2 -- with: -- name: build-result -- path: . -- -- statik: -- name: Generate the static listing -- runs-on: ubuntu-latest -- needs: build -- steps: -- - name: Download compiled files -- uses: actions/download-artifact@v2 -- with: -- name: build-result -- -- - name: Install go -- uses: actions/setup-go@v3 -- with: -- go-version: ">=1.18.0" -- -- - name: Install statik -- run: go install github.com/lucat1/statik@latest -- -- - name: Update packages and install rsync -- run: sudo apt install rsync -+ - name: Recursively compile xopp files -+ run: rec "\.xopp$" /usr/bin/xopp2pdf - - - name: Generate static directory listing -- run: $(go env GOPATH)/bin/statik -page .github/workflows/page.gohtml -l -b "https://${{ github.event.repository.owner.name }}.github.io/${{ github.event.repository.name }}/" -i "$REGEX_INCLUDE" site -+ 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@v2 -+ uses: actions/upload-artifact@v3 - with: -- name: statik-build -+ name: build - path: ./site - - deploy: diff --git a/.github/workflows/md2pdf b/.github/workflows/md2pdf deleted file mode 100755 index 54f62a2..0000000 --- a/.github/workflows/md2pdf +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex - -pandoc --pdf-engine=xelatex -t pdf $1 -o ${1%.md}.pdf diff --git a/.github/workflows/page.gohtml b/.github/workflows/page.gohtml deleted file mode 100644 index 19d3392..0000000 --- a/.github/workflows/page.gohtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - Index of {{ .Root.URL.Path }} - - - - - - - -

- Index of csunibo/{{ range $i,$p := .Parts }}{{ $p.Name }}/{{ end }} -

-
-
- {{ range $i,$d := .Root.Directories }} - {{ $d.Name }} -

{{ $d.ModTime.Format "02 Jan 06 15:04 MST" }}

-

{{ $d.Size }}

- {{ end }} - {{ range $i,$f := .Root.Files }} - {{ $f.Name }} -

{{ $f.ModTime.Format "02 Jan 06 15:04 MST" }}

-

{{ $f.Size }}

- {{ end }} -
-
-

Generated by statik on {{ .Today.Format "02 Jan 06 15:04 MST" }}

- - diff --git a/.github/workflows/rec b/.github/workflows/rec deleted file mode 100755 index 07d64b3..0000000 --- a/.github/workflows/rec +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -ex - -# The chaining of find and grep was deemded necessary due to find's lack of a -# proper regex implementation in find. Also note that on linux find does not -# support -E like on BSDs. -for file in $(find . | grep -E "$1"); do - back=$PWD - cd $(dirname $file) - $2 $(basename $file) - cd $back -done