Skip to content

Commit

Permalink
feat: add theme as hugo module (#47)
Browse files Browse the repository at this point in the history
This commit exposes the theme as a hugo module
that can be imported into other hugo websites. As
a part of this change, it moves the example of the
website to a standard `exampleSite`.

Another change that comes with this commit is the
transition of all linting and formatting
tools/checks away from node, towards tools that
are installed and used with nix. This is done
primarily because consumers of the theme will need
to download the same node dependencies as our repo
has, and I don't want there to be any extraneous
dependencies that are purely used for managing
this repository.

resolves #34
  • Loading branch information
cjshearer committed Jun 22, 2024
1 parent 1b18f7a commit d5aff7e
Show file tree
Hide file tree
Showing 35 changed files with 1,728 additions and 3,087 deletions.
2 changes: 0 additions & 2 deletions .commitlintrc.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .github/actions/setup-runner/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ runs:
steps:
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/magic-nix-cache-action@v7
- uses: DeterminateSystems/flake-checker-action@v8
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
id: pages
uses: actions/configure-pages@v5
- name: Build
# HACK: https://github.com/NixOS/nix/issues/5663#issuecomment-2010521981
# see baseURL input in flake.nix for more details
run: nix build --override-input baseURL file+file://<(printf %s "${{ steps.pages.outputs.base_url }}")
run: nix build
- if: github.ref == 'refs/heads/main'
name: Upload Artifact
uses: actions/upload-pages-artifact@v3
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-runner
- uses: DeterminateSystems/flake-checker-action@v8
- shell: bash
run: nix flake check
12 changes: 0 additions & 12 deletions .github/workflows/lint.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
build
result
public
resources
node_modules
hugo_stats.json
.hugo_build.lock

*.crt
*.key

.direnv
.pre-commit-config.yaml
result
Empty file removed .hugo_build.lock
Empty file.
11 changes: 0 additions & 11 deletions .prettierignore

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions .stylelintrc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "stylelint.vscode-stylelint"]
"recommendations": ["biomejs.biome"]
}
19 changes: 5 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
{
"[nix]": {
"editor.defaultFormatter": "jnoortheen.nix-ide"
},
"css.validate": false,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.format.enable": true,
"eslint.rules.customizations": [
{
"rule": "*",
"severity": "warn"
}
],
"stylelint.configFile": ".stylelintrc.yaml",
"stylelint.validate": ["css"],
"[nix]": {
"editor.defaultFormatter": "jnoortheen.nix-ide"
}
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
}
121 changes: 101 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,120 @@
# modern-hugo-resume

_A minimal static resume builder; inspired by [sproogen's modern-resume-theme](https://github.com/sproogen/modern-resume-theme) and [mnjul's html-resume](https://github.com/mnjul/html-resume). Powered by Hugo, Tailwind CSS, and GitHub Pages._
A responsive, minimal, print-friendly resume builder. Fork it as a standalone website, or use as a theme in a new or existing Hugo site. Powered by Hugo, Tailwind CSS, Nix, and GitHub Pages.

_Host your own resume on GitHub for free!_

## Setup
## Requirements

### Remote Repository
Can be installed manually, or with `nix develop`:

1. [Fork](https://github.com/cjshearer/modern-hugo-resume/fork) this repository, naming it `<your_username>.github.io`.
2. In your new repository, go to `Settings > Pages` and under "Build and deployment" select "GitHub Actions" as the source.
3. Go to `Actions` and click "Enable workflows". When you next push to the `main` branch of your repository, the resume site will automatically be built and deployed to `https://<your_username>.github.io`.
1. Install [`hugo`](https://gohugo.io/installation/) 1.27.0+extended.
2. Install [`go`](https://go.dev/dl/) >= 1.22.3.
3. Install `node` >= 20.2.0 with [nvm](https://github.com/nvm-sh/nvm).
4. Install `pnpm` with `corepack enable`.
5. Run `pnpm install`.

## Quick Start

Follow this guide to quickly deploy your resume to github pages.

### 1. Fork this repository

[Fork this repository](https://github.com/cjshearer/modern-hugo-resume/fork), naming it `<your_username>.github.io`.

### 2. Allow GitHub Actions to Deploy to GitHub Pages

Under `(your repo) > Settings > Pages > Build and Deployment > Source`, select "GitHub Actions" as the source.

### 3. Enable GitHub Actions Workflows

Go to `(your repo) > Actions` and click "Enable workflows". These are disabled by default on forks, to prevent unintended workflow runs.

### 4. Edit the Resume to Deploy the Site

Edit the resume at `(your repo) > exampleSite/content/_index.md` using the github editor. When you commit it, the resume site will automatically be built and deployed to `https://<your_username>.github.io`.

> [!TIP]
> You can also trigger the workflow to build and deploy the website by going to `Actions > ./github/workflows/deploy.yaml` and clicking "run workflow".
> You can skip editing the resume and trigger the build and deploy workflow manually by going to `Actions > ./github/workflows/deploy.yaml` and clicking "run workflow".
### Local Repository
## Minimal Setup

#### With [Nix](https://nixos.org/download/)
Follow this guide if you want to handle deployment yourself.

Run `nix develop` (or install [nix-direnv](https://github.com/nix-community/nix-direnv)).
> [!TIP]
> Feel free to adapt our nix-based `.github` workflows to your website. An example of this will be available on my [my website's repo](https://github.com/cjshearer/cjshearer.dev).
#### Without Nix
### 1. Create and Clone Your New Repository

1. Install [`hugo`](https://gohugo.io/installation/) 1.27.0+extended.
2. Install `node` >= 20.2.0 with [nvm](https://github.com/nvm-sh/nvm).
3. Install `pnpm` with `corepack enable`.
4. Run `pnpm install`.
[Create a new repository](https://github.com/new), naming it `<your_username>.github.io` and cloning it locally.

### 2. Initialize a Hugo Module

Inside your local git repository, create a `go.mod` file with:

```sh
hugo mod init github.com/<your username>/<your repo name>
```

### 3. Import this Theme

Copy our `exampleSite/hugo.toml` to your repo's root directory, deleting the `replacements` line and editing the `baseURL`.

```diff
- baseURL = "https://cjshearer.github.io/modern-hugo-resume"
+ baseURL = "https://<your_username>.github.io/<your_repo_name>"
...
[module]
- replacements = "github.com/cjshearer/modern-hugo-resume -> ../.."

[[module.imports]]
path = "github.com/cjshearer/modern-hugo-resume"
...
```

### 4. Install Node Dependencies

Some of our dependencies (e.g. `tailwindcss`) are sourced from `npm`. Generate a `package.json` for these dependencies and install them with your preferred node package manager:

```sh
hugo mod npm pack
pnpm install
```

### 5. Write your Resume

Add your resume as a markdown file located in `content/_index.md`. See `exampleSite/content/_index.md` for an example. Be sure to include the frontmatter:
```yaml
---
title: Software Developer
description: Full Stack Software Developer Resume
faviconText: 💼
layout: modern-hugo-resume
---
```

### 6. Run your Site

```sh
hugo server
```

## Local Development

## Development
Development of this repository uses the following commands frequently.

### Rebuild on file change
### Common Nix Commands
```sh
nix build # build the production site, exactly the same way it's done in CI
nix flake check # run formatter/linter checks, exactly the same way it's done in CI
nix develop # open a development environment with requirements satisfied
```

To rebuild changes automatically, run `pnpm dev`.
#### Common pnpm Commands

### Build
```sh
cd exampleSite # <- don't forget this

To create a production build, run `pnpm build`.
pnpm dev # rebuild changes automatically
pnpm build # create a production build
```
27 changes: 27 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"css": {
"formatter": {
"enabled": true,
"indentStyle": "space"
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"vcs": {
"clientKind": "git",
"defaultBranch": "main",
"enabled": true,
"useIgnoreFile": true
}
}
Loading

0 comments on commit d5aff7e

Please sign in to comment.