From 5006d47f201082c3a7d2b96a214d4ac9166d1f23 Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 20:54:09 -0400 Subject: [PATCH] Add new CI setup to build makefiles when respective docs change --- .github/workflows/ci.yml | 83 ++++++++++++++++++++++++++++++++++ .github/workflows/makefile.yml | 23 ---------- .github/workflows/publish.yml | 65 ++++++++++++++++++++++++++ board-procedures/Makefile | 4 +- bylaws/Makefile | 4 +- policies/Makefile | 4 +- 6 files changed, 154 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/makefile.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d9485cd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +name: LaTeX CI + +on: +pull_request: +branches: [ master ] +push: +branches: [ master ] + +jobs: +changes: +runs-on: ubuntu-latest + +outputs: + matrix: ${{ steps.matrix.outputs.matrix }} + +steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - id: matrix + shell: bash + run: | + DOCS=("bylaws" "policies" "board-procedures") + + if [ "${{ github.event_name }}" = "pull_request" ]; then + BASE_SHA="${{ github.event.pull_request.base.sha }}" + else + BASE_SHA="${{ github.event.before }}" + fi + + CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") + + SHARED_CHANGED=false + for file in logo.png mathsoc.cls mathsoc.sty title.tex; do + if echo "$CHANGED" | grep -q "^${file}$"; then + SHARED_CHANGED=true + break + fi + done + + if [ "$SHARED_CHANGED" = true ]; then + MATRIX='{"directory":["bylaws","policies","board-procedures"]}' + else + DIRS=() + + for dir in "${DOCS[@]}"; do + if echo "$CHANGED" | grep -q "^${dir}/"; then + DIRS+=("\"${dir}\"") + fi + done + + MATRIX="{\"directory\":[$(IFS=,; echo "${DIRS[*]}")]}" + fi + + echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" + +build: +needs: changes + +if: ${{ fromJson(needs.changes.outputs.matrix).directory[0] != null }} + +runs-on: ubuntu-latest + +strategy: + fail-fast: false + matrix: ${{ fromJson(needs.changes.outputs.matrix) }} + +container: + image: ghcr.io/xu-cheng/texlive-full:latest + +steps: + - uses: actions/checkout@v4 + + - name: Build ${{ matrix.directory }} + run: | + make -C "${{ matrix.directory }}" public + + - name: Upload PDF + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.directory }} + path: ${{ matrix.directory }}/dist/*.pdf diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml deleted file mode 100644 index b7b352a..0000000 --- a/.github/workflows/makefile.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Makefile CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - name: configure - - name: compile - uses: xu-cheng/latex-action@v2 - - name: make - run: | - cd policies - make all - diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dfacc96 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,65 @@ +name: Publish PDFs + +on: +push: +branches: +- master + +permissions: +contents: read +pages: write +id-token: write + +concurrency: +group: pages +cancel-in-progress: true + +jobs: +build: +runs-on: ubuntu-latest + +container: + image: ghcr.io/xu-cheng/texlive-full:latest + +steps: + - uses: actions/checkout@v4 + + - name: Build bylaws + run: make -C bylaws public + + - name: Build policies + run: make -C policies public + + - name: Build board-procedures + run: make -C board-procedures public + + - name: Prepare Pages content + run: | + mkdir site + + cp bylaws/dist/*.pdf site/ + cp policies/dist/*.pdf site/ + cp board-procedures/dist/*.pdf site/ + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: site + +deploy: +needs: build + +runs-on: ubuntu-latest + +environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + +permissions: + pages: write + id-token: write + +steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/board-procedures/Makefile b/board-procedures/Makefile index 270c8e0..e7cd7a9 100644 --- a/board-procedures/Makefile +++ b/board-procedures/Makefile @@ -24,10 +24,10 @@ all: public touch .refresh $(DIST_FOLDER): - mkdir ./dist + mkdir -p ./dist $(COMPILATION_FOLDER): - mkdir ./bin + mkdir -p ./bin public: $(SOURCES_P) $(LATEXMK) $(LATEXMKOPT) \ diff --git a/bylaws/Makefile b/bylaws/Makefile index d66bbf3..5834b9d 100644 --- a/bylaws/Makefile +++ b/bylaws/Makefile @@ -27,10 +27,10 @@ all: public annotated touch .refresh $(DIST_FOLDER): - mkdir ./dist + mkdir -p ./dist $(COMPILATION_FOLDER): - mkdir ./bin + mkdir -p ./bin watch: .refresh $(SOURCES_C) $(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \ diff --git a/policies/Makefile b/policies/Makefile index 1f0837a..9bcdee6 100644 --- a/policies/Makefile +++ b/policies/Makefile @@ -25,10 +25,10 @@ all: public touch .refresh $(DIST_FOLDER): - mkdir ./dist + mkdir -p ./dist $(COMPILATION_FOLDER): - mkdir ./bin + mkdir -p ./bin watch: .refresh $(SOURCES_C) $(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \