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

unbreak build + release PDF on tag pushes #2

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
51 changes: 51 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Build tagged version

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y texlive-latex-extra make

- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Verify Tag is on Main Branch
id: verify_tag
run: |
TAG_COMMIT=$(git rev-list -n 1 ${GITHUB_REF})
if git merge-base --is-ancestor $TAG_COMMIT origin/main; then
echo "on_main=true" >>"$GITHUB_OUTPUT"
else
echo "on_main=false" >>"$GITHUB_OUTPUT"
fi

- name: Build
id: build_step
run: |
cd src
make
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "pdfFilename=$GITHUB_WORKSPACE/src/$TAG_NAME.pdf" >> "$GITHUB_OUTPUT"
mv -v ts.pdf "$TAG_NAME.pdf" && stat "$TAG_NAME.pdf" && realpath "$TAG_NAME.pdf"

- name: Release
if: >
steps.verify_tag.outputs.on_main == 'true' &&
steps.build_step.outcome == 'success'
uses: ncipollo/release-action@v1
with:
artifacts: '${{ steps.build_step.outputs.pdfFilename }}'
generateReleaseNotes: true
artifactContentType: 'application/pdf'
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/external/listings"]
path = src/external/listings
url = git://git.gnu.org.ua/listings.git
4 changes: 3 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

FIGURES = $(patsubst %.dot,%.pdf,$(wildcard *.dot))

TSPDF = pdflatex ts | grep -v "^Overfull"
TSPDF = TEXINPUTS=./external/listings//: pdflatex ts.tex | grep -v "^Overfull"

default: rebuild

Expand All @@ -24,6 +24,8 @@ refresh:
$(TSPDF)

rebuild:
test -d ../.git && git submodule update --init --recursive
make -C ./external/listings
$(TSPDF)
$(TSPDF)
$(TSPDF)
Expand Down
1 change: 1 addition & 0 deletions src/external/listings
Submodule listings added at 2d9771
4 changes: 3 additions & 1 deletion src/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@
% Set the xref label for a clause to be "Clause n", not just "n".
\makeatletter
\newcommand{\customlabel}[2]{%
\@bsphack \begingroup \protected@edef \@currentlabel {\protect \M@TitleReference{#2}{\M@currentTitle}}\MNR@label{#1}\endgroup \@esphack%
\@bsphack
\protected@write\@auxout{}{\string\newlabel{#1}{{#2}{\thepage}}}%
\@esphack
}
\makeatother
\newcommand{\clauselabel}[1]{\customlabel{#1}{Clause \thechapter}}
Expand Down
2 changes: 1 addition & 1 deletion src/ts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
\usepackage[iso,american]
{isodate} % use iso format for dates
\usepackage[final]
{listings} % code listings
{./external/listings/listings} % code listings
\usepackage{longtable} % auto-breaking tables
\usepackage{ltcaption} % fix captions for long tables
\usepackage{relsize} % provide relative font size changes
Expand Down