Skip to content

Commit

Permalink
docs: update README for CI/CD changes (#4)
Browse files Browse the repository at this point in the history
* docs: update docs for CI/CD changes

* ci: deploy to the production environment

* ci: skip if we aren't building an image
  • Loading branch information
kevin-secrist authored Jan 6, 2025
1 parent ab883aa commit b589945
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
if: steps.select_image.outputs.build_image == 'true'
uses: docker/setup-buildx-action@v3
- name: Build and push
if: steps.select_image.outputs.build_image == 'true'
Expand Down Expand Up @@ -88,6 +89,9 @@ jobs:
release:
name: Release
needs: build-documents
environment:
name: production
url: https://secrist.dev/about/resume
if: github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Building a LaTeX project locally normally requires a LaTeX environment which can

Instead, for this project you only need to install a few things:

* Docker for Windows or Linux
* Docker
* VS Code
* Visual Studio Code Remote - Containers Extension (optional)

That's basically it. There's more detailed documentation about using [remote containers within VS Code](https://code.visualstudio.com/docs/remote/containers) that may be helpful for setup. Once everything is installed, VS Code can build a Docker image and run a container locally based on the [`Dockerfile`](Dockerfile) and [`devcontainer.json`](.devcontainer/devcontainer.json). This includes the installation of a VS Code server and LaTeX Workshop extension inside the container for syntax highighting, intellisense, automatic builds, and PDF previews.
That's basically it. There's more detailed documentation about using [remote containers within VS Code](https://code.visualstudio.com/docs/remote/containers) that may be helpful for setup. Once everything is installed, VS Code will pull a [Docker image](https://github.com/kevin-secrist/resume/pkgs/container/latex) (based on the [`Dockerfile`](Dockerfile)) and run a container locally based on the arguments in [`devcontainer.json`](.devcontainer/devcontainer.json). This includes the automatic installation of a VS Code server and LaTeX Workshop extension inside the container for syntax highighting, intellisense, automatic builds, and PDF previews.

The `Dockerfile` is set up to mount a volume at `/data`, and the `devcontainer.json` specifies arguments to mount the workspace within the container. Build artifacts are dropped into `/data/out`.

Expand All @@ -27,6 +27,16 @@ docker build -t latex-build .
docker run -v $PWD:/data -w /data/src latex-build ./build.sh
```

# CI/CD

This repo is set up to automatically build PRs, and release the newly built artifacts on merge to `main`. See [.github](.github) for the workflow definitions. New docker images are only built/pushed in PRs if the `Dockerfile` differs from what's in the `main` branch, allowing for a quick dev cycle when not developing locally (like when making changes directly in GitHub - this repo is for a document after all).

# Screenshot

This is what it looks like to develop locally, using the Dev Container in VS Code. On save, the file is rebuilt and automatically refreshed (thanks to the `james-yu.latex-workshop` extension).

![screenshot](./docs/screenshot.png)

# Inspirations

Some of the ideas for how to create my Dockerfile came from the [Overleaf](https://github.com/overleaf/overleaf) project as well as [blang/latex-docker](https://github.com/blang/latex-docker). I also recommend [Overleaf](https://www.overleaf.com/) for getting started writing LaTeX documents without requiring a complicated local setup - and they also allow you to self-host with Docker which can be very convenient.
Expand Down

0 comments on commit b589945

Please sign in to comment.