-
Notifications
You must be signed in to change notification settings - Fork 0
220 lines (172 loc) Β· 6 KB
/
auto_build.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
---
name: Resume Actions
on:
push:
branches:
- main
jobs:
Check_Files_Diff:
# Check what files were added
name: Chceking Commits π
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check Modified Files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file != 'resume.yml' ]]; then
echo "Modified files are not important to updating the docs/resume.index"
echo "::set-output name=run_job::false"
break
else
echo "::set-output name=run_job::true"
fi
done < files.txt
Repo_Linting:
# Verify json.yml and workflow conform to yaml linting
name: Repo Linting π§
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install YAML Lint
run: pip install yamllint
- name: Lint YAML files
run: yamllint -c .yamlignore.yml resume.yml .github/workflows
Build-Resume-JSON:
# Convert json.yml into JSON format && Load into an artifact
name: Building resume.json π§
needs: Check_Files_Diff
# if: needs.Check_Files_Diff.outputs.run_job == 'true'
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install requirements.txt
run: pip install -r ${{ github.workspace }}/requirements.txt
- name: Convert 'resume.yml' to 'resume.json'
run: cat ${{ github.workspace }}/resume.yml | yq > ${{ github.workspace }}/resume.json
- name: Create JSON Resume Artifact
uses: actions/upload-artifact@v2
with:
name: resume.json
path: ${{ github.workspace }}/resume.json
Verify-JSON:
# Verify converted resume.json formats to JSON-Resume's syantax
name: JSON Syantax Inspect π¬
needs: [Build-Resume-JSON, Check_Files_Diff]
runs-on: ubuntu-20.04
steps:
- name: Download the resume artifact
uses: actions/download-artifact@v2
with:
name: resume.json
- name: Install Resume CLI
run: npm install -g resume-cli
- name: Validate Resume Schema
run: resume validate resume.json
Convert-Resume-HTML:
# Building HTML and PDF artifacts
name: Converting to HTML π
needs: [Build-Resume-JSON, Verify-JSON]
runs-on: ubuntu-20.04
steps:
- name: Download the resume artifact
uses: actions/download-artifact@v2
with:
name: resume.json
- name: Install Resume CLI
run: npm install -g resume-cli
- name: Install Resume Themes
run: npm install jsonresume-theme-even jsonresume-theme-eddywashere
- name: Convert Resume to HTML
run: resume export resume.html --theme eddywashere --resume resume.json --format html
- name: Create HTML Resume Artifact
uses: actions/upload-artifact@v2
with:
name: resume.html
path: ${{ github.workspace }}/resume.html
Convert-Resume-PDF:
# Building PDF artifacts
name: Building PDF Artifact πΎ
needs: [Build-Resume-JSON, Verify-JSON]
runs-on: ubuntu-20.04
steps:
- name: Download the resume artifact
uses: actions/download-artifact@v2
with:
name: resume.json
- name: Install Resume CLI
run: npm install -g resume-cli
- name: Install Resume Themes
run: npm install jsonresume-theme-even jsonresume-theme-eddywashere
- name: Convert Resume to PDF
# run: resume export resume.html --theme eddywashere --resume resume.json --format html
run: resume export resume.pdf --resume resume.json --format pdf
- name: Create PDF Resume Artifact
uses: actions/upload-artifact@v2
with:
name: resume.pdf
path: ${{ github.workspace }}/resume.pdf
Deploy-To-Public-GIST:
name: Publish to Public GIST π
needs: [Build-Resume-JSON]
runs-on: ubuntu-20.04
environment: github-pages
steps:
- name: Download the resume artifact
uses: actions/download-artifact@v2
with:
name: resume.json
- name: Deploy
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.TOKEN }}
gist_id: 91db4ee7d322c69ed3131fd586ae03b2
file_path: resume.json
file_type: json
# TODO: The below step is no longer needed. Need to consider updating the
# resume GIST:
# https://gist.github.com/mrreyes512/91db4ee7d322c69ed3131fd586ae03b2
# Deploy-To-GHPage:
# # Make a commit to the gh-page branch
# name: Updating Index.html π
# needs: [Convert-Resume-HTML, Convert-Resume-PDF]
# runs-on: ubuntu-20.04
# steps:
# - name: Check out repository code
# uses: actions/checkout@v2
# with:
# ref: gh-page
# - name: Download the resume HTML artifact
# uses: actions/download-artifact@v2
# with:
# name: resume.html
# - name: Download the resume PDF artifact
# uses: actions/download-artifact@v2
# with:
# name: resume.pdf
# - name: Get current date
# id: date
# run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
# - run: mkdir -p docs && mv resume.html docs/index.html
# - run: mv resume.pdf docs/resume_${{ steps.date.outputs.date }}.pdf
# - name: Publish GH Page
# uses: EndBug/add-and-commit@v7
# with:
# add: docs/
# branch: gh-page
# message: Auto Update index.html
# author_name: Mark Reyes
# committer_name: GitHub Actions
# committer_email: [email protected]