-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmarkdown2pdf.yml
108 lines (100 loc) · 3.13 KB
/
markdown2pdf.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
trigger: none
pr:
autoCancel: true
drafts: false
name: 📝 Convert Markdown
variables:
FIRST_CHANGE_DESCRIPTION: Initial draft
FOLDER: docs
GIT_LOG_LIMIT: 15
HISTORY_FILE:
MAIN_AUTHOR: Innofactor
ORDER_FILE: document.order
OUT_FILE: document.pdf
PROJECT:
REPLACE_FILE:
SKIP_GIT_COMMIT_HISTORY: false
SUBTITLE: Design Document
TITLE: DNS
WORKFLOW_VERSION: v3
pool:
vmImage: ubuntu-22.04
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0
- task: Cache@2
displayName: Cache TeX Live
inputs:
key: 'texlive | "$(Agent.OS)"'
path: /opt/texlive
- task: Bash@3
displayName: Install tools
env:
SCRIPT: install-tools
VERSION: ${{ variables.WORKFLOW_VERSION }}
inputs:
targetType: inline
script: |
files=(
"${SCRIPT}.sh"
texlive.profile
texlive_packages.txt
requirements.txt
)
for file in "${files[@]}"; do
uri="https://github.com/innofactororg/markdown2pdf/raw/${VERSION}/tools/${file}"
HTTP_CODE=$(curl -sSL --remote-name --retry 4 \
--write-out "%{response_code}" \
--header 'Accept: application/vnd.github.raw' "${uri}"
)
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -gt 299 ]; then
echo "##[error]Unable to get ${uri}! Response code: ${HTTP_CODE}"
exit 1
fi
done
chmod +x "${SCRIPT}.sh"
./"${SCRIPT}.sh"
- task: Bash@3
displayName: Build PDF
env:
AUTHOR: ${{ variables.MAIN_AUTHOR }}
DESCRIPTION: ${{ variables.FIRST_CHANGE_DESCRIPTION }}
SKIP_GIT_HISTORY: ${{ variables.SKIP_GIT_COMMIT_HISTORY }}
HISTORY: ${{ variables.HISTORY_FILE }}
LIMIT: ${{ variables.GIT_LOG_LIMIT }}
SCRIPT: convert
VERSION: ${{ variables.WORKFLOW_VERSION }}
inputs:
targetType: inline
script: |
files=(
"${SCRIPT}.sh"
designdoc.tex
designdoc-cover.png
designdoc-logo.png
)
for file in "${files[@]}"; do
uri="https://github.com/innofactororg/markdown2pdf/raw/${VERSION}/tools/${file}"
HTTP_CODE=$(curl -sSL --remote-name --retry 4 \
--write-out "%{response_code}" \
--header 'Accept: application/vnd.github.raw' "${uri}"
)
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -gt 299 ]; then
echo "##[error]Unable to get ${uri}! Response code: ${HTTP_CODE}"
exit 1
fi
done
git config --global --add safe.directory '*'
chmod +x "${SCRIPT}.sh"
./"${SCRIPT}.sh" -a "${AUTHOR}" -d "${DESCRIPTION}" -f "${FOLDER}" \
-force "${SKIP_GIT_HISTORY}" -h "${HISTORY}" -l "${LIMIT}" \
-o "${ORDER_FILE}" -out "${OUT_FILE}" -p "${PROJECT}" \
-r "${REPLACE_FILE}" -s "${SUBTITLE}" -t "${TITLE}" \
--template "designdoc"
- task: PublishPipelineArtifact@1
displayName: Publish PDF
inputs:
targetPath: $(Build.SourcesDirectory)/${{ variables.OUT_FILE }}
artifact: ${{ variables.OUT_FILE }}
publishLocation: pipeline