Skip to content

build: actualizar variables del curso correspondiente #117

build: actualizar variables del curso correspondiente

build: actualizar variables del curso correspondiente #117

Workflow file for this run

name: Publicar
on:
workflow_dispatch:
push:
tags:
- '*'
env:
ACADEMIC_YEAR: 2024-2025
SITE_ROOT: https://ull-esit-sistemas-operativos.github.io/ssoo-apuntes/so2425
jobs:
build-and-publish:
runs-on: ubuntu-22.04
steps:
- name: Obtener el proyecto
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Obtener el nombre de la rama
id: branch_name
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> "$GITHUB_ENV"
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
- name: Configurar Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Instalar dependencias (nativas)
run: |
sudo apt-get update -y -qq
sudo apt-get install libxml2-dev libxslt-dev pkg-config
# asciidoctor-mathematical
sudo apt-get install bison flex libffi-dev libxml2-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libwebp-dev libzstd-dev fonts-lyx cmake
- name: Instalar dependencias (gemas)
run: |
bundle config set --local path vendor/bundle
bundle config set --local build.nokogiri --use-system-libraries
bundle config set --local without dev epub3
bundle config set --local deployment true
bundle install
- name: Generar la documentación
run: bundle exec rake build:www[$SITE_ROOT] build:pdf DOCUMENT_NAME=sistemas_operativos
- name: Publicar el sitio web
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: output/www
target-folder: ${{ env.SOURCE_NAME }}
clean: true
- name: Generar archivos para actualizar la raíz del sitio web
if: ${{ env.SOURCE_NAME == vars.CURRENT_BRANCH }}
run: |
mkdir -p ${{ runner.temp }}/html
cp output/www/sitemap.xml ${{ runner.temp }}/html
cat << EOF > ${{ runner.temp }}/html/index.html
<!DOCTYPE HTML>
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0;url=https://ull-esit-sistemas-operativos.github.io/ssoo-apuntes/${{ env.SOURCE_NAME }}/">
<link rel="canonical" href="https://ull-esit-sistemas-operativos.github.io/ssoo-apuntes/${{ env.SOURCE_NAME }}/">
</head>
</html>
EOF
- name: Actualizar la raíz del sitio web
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ env.SOURCE_NAME == vars.CURRENT_BRANCH }}
with:
branch: gh-pages
folder: ${{ runner.temp }}/html
clean: false
- name: Publicar el PDF en 'Releases'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: output/pdf/*.pdf
tag: ${{ github.ref }}
file_glob: true
release_name: "Curso ${{ env.ACADEMIC_YEAR }}"
body: "Apuntes de sistemas operativos del curso ${{ env.ACADEMIC_YEAR }}."
overwrite: true