-
Notifications
You must be signed in to change notification settings - Fork 4
193 lines (161 loc) · 5.48 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
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
name: CI/CD
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deps:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
- name: Install dependencies
run: npm ci
lint:
needs: deps
runs-on: ubuntu-24.04
strategy:
matrix:
linter: [eslint, prettier, stylelint]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ${{ matrix.linter }}
run: npm run ${{ matrix.linter }}
test:
needs: deps
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:cov
build:
needs: [lint, test]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build site
run: npm run build
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Install (mostly Chrome) dependencies
run: |
sudo apt-get update
sudo apt-get install -yq --no-install-recommends \
libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgbm1 libgcc1 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 \
libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst \
fonts-freefont-ttf libnss3 lsb-release xdg-utils wget gnupg
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo tee /etc/apt/trusted.gpg.d/google.asc >/dev/null
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -y --no-install-recommends google-chrome-stable
npx puppeteer browsers install chrome
- name: Install Source Sans Pro
run: |
mkdir -p ~/.fonts
wget https://github.com/adobe-fonts/source-sans/releases/download/3.052R/OTF-source-sans-3.052R.zip
unzip OTF-source-sans-3.052R.zip
cp -v OTF/*.otf ~/.fonts/
fc-cache -f -v
- name: Generate PDF
run: npm run pdf
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: resume-pdf
path: ./*.pdf
retention-days: 1
deploy:
needs: build
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build]
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
release_name: ${{ steps.release_info.outputs.release_name }}
steps:
- uses: actions/checkout@v4
- name: Install just
run: |
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | \
sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
sudo apt-get update
sudo apt-get install just -y --no-install-recommends
- name: Generate release notes
run: just release-notes
- name: Set release info
id: release_info
run: |
TODAY="($(TZ=Africa/Lusaka date --iso))"
echo "release_name=${{ github.ref_name }} $TODAY" >> $GITHUB_OUTPUT
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: resume-pdf
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.release_info.outputs.release_name }}
body_path: ../LATEST_RELEASE_NOTES.md
files: |
artifacts/*.pdf