Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[setup](build): some are mine, others from @mszep/pandoc_resume #104

Merged
merged 10 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.tuc
*.log
*.pdf
*.html
resume.tex
*.swo
*.swp
*.docx
*.rtf
55 changes: 55 additions & 0 deletions .github/workflows/docker-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow updates the docker container which has context and
# pandoc installed, and on which the resume documents are built. The
# workflow runs whenever the dockerfile is changed, and updates the
# container image in the Github Packages registry.

name: Publish Docker Image

# Controls when the action will run.
on:
# Triggers the workflow on push events but only for the master branch
push:
branches: [ master ]
paths-ignore:
- 'markdown/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and Push to GitHub Packages
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: .docker/resume.dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is a basic workflow to help you get started with Actions

name: build-resume

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths:
- 'markdown/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-resume:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Test directory contents
run: 'ls -al'

- name: Build resume
uses: ./actions

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: Resume PDF # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: output/*.pdf

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.log
*.swo
*.swp
output/
result
result-*
.envrc
.direnv
7 changes: 7 additions & 0 deletions .pandoc/pandoc.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM pandoc/latex:2.9

RUN apk add make texlive

ENV TEXMF /usr/share/texmf-dist

COPY actions/entrypoint.sh /entrypoint.sh
60 changes: 60 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
OUT_DIR=output
IN_DIR=markdown
STYLES_DIR=styles
STYLE=chmduquesne

all: html pdf docx

kitchensink: html pdf docx rtf

pdf: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.pdf; \
pandoc --standalone --template $(STYLES_DIR)/$(STYLE).tex \
--from markdown --to context \
--variable papersize=A4 \
--output $(OUT_DIR)/$$FILE_NAME.tex $$f > /dev/null; \
mtxrun --path=$(OUT_DIR) --result=$$FILE_NAME.pdf --script context $$FILE_NAME.tex > $(OUT_DIR)/context_$$FILE_NAME.log 2>&1; \
done

html: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.html; \
pandoc --standalone --include-in-header $(STYLES_DIR)/$(STYLE).css \
--lua-filter=pdc-links-target-blank.lua \
--from markdown --to html \
--output $(OUT_DIR)/$$FILE_NAME.html $$f \
--metadata pagetitle=$$FILE_NAME;\
done

docx: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.docx; \
pandoc --standalone $$SMART $$f --output $(OUT_DIR)/$$FILE_NAME.docx; \
done

rtf: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.rtf; \
pandoc --standalone $$SMART $$f --output $(OUT_DIR)/$$FILE_NAME.rtf; \
done

init: dir version

dir:
mkdir -p $(OUT_DIR)

version:
PANDOC_VERSION=`pandoc --version | head -1 | cut -d' ' -f2 | cut -d'.' -f1`; \
if [ "$$PANDOC_VERSION" -eq "2" ]; then \
SMART=-smart; \
else \
SMART=--smart; \
fi \

clean:
rm -f $(OUT_DIR)/*
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Reporting Security Issues

To report a security issue, please email [ralph.hightower+blog-[email protected]](milto:ralph.hightower+blog[email protected])
To report a security issue, please email [ralph.hightower+EOL-Hightower-[email protected]](milto:ralph.hightower+EOL-Hightower[email protected])
with a description of the issue, the steps you took to create the issue,
affected versions, and, if known, mitigations for the issue.

Expand Down
2 changes: 1 addition & 1 deletion SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This project uses GitHub issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.

- **[RalphHightower/blog](https://github.com/RalphHightower/blog/)** is under active development and maintained by @RalphHightower. I will do my best to respond to support, feature requests, and community questions in a timely manner.
- **[RalphHightower/EOL-Hightower](https://github.com/RalphHightower/EOL-Hightower/)** is under active development and maintained by @RalphHightower. I will do my best to respond to support, feature requests, and community questions in a timely manner.

## @RalphHightower Support Policy

Expand Down
7 changes: 7 additions & 0 deletions action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# action.yml
name: 'Texlive Build'
description: 'Build a document using texlive'
runs:
using: 'docker'
image: 'docker://ghcr.io/mszep/pandoc_resume:master'
entrypoint: '/entrypoint.sh'
3 changes: 3 additions & 0 deletions action/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

sh -c "cd /home/app/resume && make pdf"
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'

services:

resume-make:
build:
context: .
dockerfile: ./.docker/resume.dockerfile
container_name: resume-make
entrypoint: /entrypoint.sh
image: resume-make
volumes:
- .:/home/app/resume:z
26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
inputs = { nixpkgs.url = "github:nixos/nixpkgs"; };

outputs = { self, nixpkgs }:
let
supportedSystems =
let
unsupportedSystems = [
# GHC not supported
"armv5tel-linux"
"armv6l-linux"
"powerpc64le-linux"
"riscv64-linux"

# "error: attribute 'busybox' missing" when building
# `bootstrap-tools`
"mipsel-linux"
];
in nixpkgs.lib.subtractLists unsupportedSystems nixpkgs.lib.systems.flakeExposed;

perSystem = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = system: import nixpkgs { inherit system; };

buildResumeFor = system:
let pkgs = pkgsFor system;
in pkgs.runCommand "build-resume" {
nativeBuildInputs = with pkgs; [ pandoc texlive.combined.scheme-context ];
} ''
cd ${self}
make OUT_DIR="$out"
'';
in {
packages = perSystem (system:
let
resume = buildResumeFor system;
in
{
inherit resume;
default = resume;
});

devShells = perSystem (system: {
default = import ./shell.nix { pkgs = pkgsFor system; };
});

devShell = perSystem (system: self.devShells.${system}.default);

defaultPackage = perSystem (system: self.packages.${system}.default);
};
}
15 changes: 15 additions & 0 deletions pdc-links-target-blank.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Add target="_blank" attributes to all http links in a Pandoc document

local function add_target_blank (link)
if string.match(link.target, '^http') then -- here .target == href attribute
link.attributes.target = '_blank' -- here .target == traget attribute
end
return link
end

-- remove lines 4 and 6 to add target="_blank" to all links, not just http(s)

return {
{ Link = add_target_blank }
}

3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell { buildInputs = [ pandoc texlive.combined.scheme-context gnumake ]; }
Loading
Loading