chore: cleanup #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |