-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (81 loc) · 3.35 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Publicar
on:
workflow_dispatch:
push:
tags:
- '*'
env:
ACADEMIC_YEAR: 2023-2024
SITE_ROOT: https://ull-esit-sistemas-operativos.github.io/ssoo-apuntes/so2324
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