Build and Deploy #16
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: "Build and Deploy" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
on: | |
workflow_dispatch: | |
inputs: | |
theme: | |
type: string | |
description: "Theme to use for building website and/or PDF document (jsonresume-theme-<theme>)" | |
required: true | |
default: macchiato-plus | |
deploy: | |
type: boolean | |
description: "Whether to deploy or not" | |
required: true | |
default: false | |
node-version: | |
type: string | |
description: "NodeJS version to use" | |
required: false | |
default: "lts/*" | |
bun-version: | |
type: string | |
description: "Bun version to use" | |
required: false | |
default: "latest" | |
chrome-version: | |
type: string | |
description: "Chrome version to use" | |
required: false | |
default: "stable" | |
env: | |
artifact-key: deployment-${{ github.sha }} | |
deployment-directory: dist | |
full-theme-name: jsonresume-theme-${{ inputs.theme }} | |
content-package-path: packages/cv-content | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Setup tooling | |
id: setup-tooling | |
uses: ./.github/actions/setup-tooling | |
with: | |
node-version: ${{ inputs.node-version }} | |
bun-version: ${{ inputs.bun-version }} | |
use-chrome: "true" | |
chrome-version: ${{ inputs.chrome-version }} | |
- name: Install selected theme | |
working-directory: ${{ env.content-package-path }} | |
run: bun install -D ${{ env.full-theme-name }} | |
- name: Build website | |
env: | |
THEME: ${{ env.full-theme-name }} | |
PUPPETEER_BROWSER_REVISION: ${{ steps.setup-tooling.outputs.chrome-version }} | |
PUPPETEER_EXECUTABLE_PATH: ${{ steps.setup-tooling.outputs.chrome-path }} | |
run: bun run build | |
- name: Create deployable artifact | |
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | |
with: | |
name: ${{ env.artifact-key }} | |
path: ${{ env.deployment-directory }} | |
deploy: | |
needs: build | |
if: ${{ inputs.deploy }} | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 | |
with: | |
artifact_name: ${{ env.artifact-key }} |