Skip to content

CI

CI #43

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
# INDONESIA
jobs:
compile_and_deploy_IND:
name: Compile
runs-on: ubuntu-latest
strategy:
matrix:
module:
[
P1/PengenalanBahasaC_IND,
P2/PerulanganPercabanganArrayString_IND,
P3/FungsidanRekursi_IND,
P4/PointerdanStruct_IND,
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup LaTeX
uses: xu-cheng/latex-action@v3
with:
root_file: main.tex
pre_compile: |
sed -i 's|% \\input{'${{ matrix.module }}'.tex|\\input{'${{ matrix.module }}'.tex|' main.tex
working_directory: .
docker_image: ghcr.io/xu-cheng/texlive-full:20240315
- name: Rename and Move Compiled PDF
run: |
mkdir -p dist
MODULE_NAME="${{matrix.module}}"
MODULE_NAME=${MODULE_NAME//\//_}
mv main.pdf dist/$MODULE_NAME.pdf
echo "MODULE_NAME_SANITIZED=${MODULE_NAME}" >> $GITHUB_ENV
- name: Upload Compiled PDF
uses: actions/upload-artifact@v4
with:
name: ${{env.MODULE_NAME_SANITIZED}}
path: dist
compile_and_deploy_ENG:
name: Compile
runs-on: ubuntu-latest
needs: [compile_and_deploy_IND]
strategy:
matrix:
module:
[
P1/PengenalanBahasaC_ENG,
P2/PerulanganPercabanganArrayString_ENG,
P3/FungsidanRekursi_ENG,
P4/PointerdanStruct_ENG,
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup LaTeX
uses: xu-cheng/latex-action@v3
with:
root_file: main.tex
pre_compile: |
sed -i 's|% \\input{'${{ matrix.module }}'.tex|\\input{'${{ matrix.module }}'.tex|' main.tex
working_directory: .
docker_image: ghcr.io/xu-cheng/texlive-full:20240315
- name: Rename and Move Compiled PDF
run: |
mkdir -p dist
MODULE_NAME="${{matrix.module}}"
MODULE_NAME=${MODULE_NAME//\//_}
mv main.pdf dist/$MODULE_NAME.pdf
echo "MODULE_NAME_SANITIZED=${MODULE_NAME}" >> $GITHUB_ENV
- name: Upload Compiled PDF
uses: actions/upload-artifact@v4
with:
name: ${{env.MODULE_NAME_SANITIZED}}
path: dist
merge-artifacts:
runs-on: ubuntu-latest
needs: [compile_and_deploy_IND, compile_and_deploy_ENG]
steps:
# Langkah 1: Checkout kode (jika diperlukan)
- uses: actions/checkout@v2
- uses: actions/upload-artifact/merge@v4
with:
name: merged-artifacts
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [merge-artifacts]
steps:
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Deploy to Pages
uses: actions/deploy-pages@v4
with:
artifact_name: merged-artifacts