-
Notifications
You must be signed in to change notification settings - Fork 4
136 lines (135 loc) · 4.81 KB
/
build-and-deploy.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build the LaTeX slides and deploy
on:
push:
branches-ignore:
- 'autodelivery**'
- 'bump-**'
- 'renovate/**'
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
pull_request:
workflow_dispatch:
workflow_run:
workflows: ["pages-build-deployment"]
types:
- completed
jobs:
# TODO: once all slides are in markdown, use the version from gh pages
compute-version:
runs-on: ubuntu-latest
outputs:
commit-count: ${{ steps.commit-counter.outputs.commits }}
version: ${{ steps.version-compute.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Count the commits so far
id: commit-counter
run: echo "::set-output name=commits::$(git rev-list --count HEAD)"
- name: Create version
id: version-compute
run: echo "::set-output name=version::${{ steps.commit-counter.outputs.commits }}.$(date +"%Y.%-m%d")"
- name: Verify the version
run: ruby -e 'unless /^\d+\.[1-9]\d*\.[1-9]\d*$/.match?("${{ steps.version-compute.outputs.version }}") then exit 1 end'
create-and-deploy-pdfs-from-website:
needs:
- compute-version
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout the pdf creation script
uses: danysk/action-checkout@0.2.22
- name: Checkout gh-pages
uses: actions/checkout@v4.2.2
with:
path: pages
ref: gh-pages
- name: Setup Ruby
uses: ruby/setup-ruby@v1.202.0
with:
working-directory: slides-markdown/shared-slides
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Update the package database
run: sudo apt-get update
- name: Install pdfinfo
run: sudo apt-get install -y poppler-utils
- name: Make the pdfs
run: slides-markdown/shared-slides/makepdfs.rb pages
- name: Deliver the pdfs
# Once all slides are in markdown, enable the conditional deployment
# if: github.event_name == 'workflow_run'
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master')
|| github.event_name == 'workflow_dispatch'
|| github.event_name == 'workflow_run'
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
artifacts: "*.pdf"
replacesArtifacts: true
tag: ${{ needs.compute-version.outputs.version }}
token: ${{ github.token }}
build-and-publish-latex:
needs:
- compute-version
runs-on: ubuntu-latest
steps:
- name: Verify the version
run: ruby -e 'unless /^\d+\.[1-9]\d*\.[1-9]\d*$/.match?("${{ needs.compute-version.outputs.version }}") then exit 1 end'
- name: Checkout
uses: danysk/action-checkout@0.2.22
- name: Compile LaTeX
id: compile
uses: DanySK/compile-latex-action@1910fcbeeeaed692e47e90c9ea1a42ecb8f6dc3a
- name: Deliver the pdfs
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master')
|| github.event_name == 'workflow_dispatch'
|| github.event_name == 'workflow_run'
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
artifacts: ${{ steps.compile.outputs.compiled-files }}
replacesArtifacts: true
tag: ${{ needs.compute-version.outputs.version }}
# deploy-archives:
# runs-on: ubuntu-latest
# needs:
# - compute-version
# steps:
# - name: Verify the version
# run: ruby -e 'unless /^\d+\.[1-9]\d*\.[1-9]\d*$/.match?("${{ needs.compute-version.outputs.version }}") then exit 1 end'
# - name: Checkout
# uses: danysk/action-checkout@0.2.2
# - name: Remove PMD/Checkstyle/Spotbugs configuration from the first labs
# run: ./cleanup_project_files.rb
# - name: Create archives
# id: archive
# run: |
# for file in workspace/*/; do
# name="${file#*/}"
# destination="${name%*/}.zip"
# echo Creating "$destination" from $file
# zip -r "$destination" "$file"
# results="$results,$destination"
# done
# - name: Release
# if: >-
# (github.event_name == 'push' && github.ref == 'refs/heads/master')
# || github.event_name == 'workflow_dispatch'
# || github.event_name == 'workflow_run'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: ncipollo/release-action@v1.10.0
# with:
# allowUpdates: true
# artifacts: "*.zip"
# replacesArtifacts: true
# tag: ${{ needs.compute-version.outputs.version }}