Skip to content

fix: ci 50

fix: ci 50 #51

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: |
MODULE_NAME="${{ matrix.module }}"
JUDUL_MODUL=$(echo "$MODULE_NAME" | sed -e 's|.*/||' -e 's|_IND||')
JUDUL_MODUL_WITH_SPACES=$(echo "$JUDUL_MODUL" | sed -r 's/([a-z])([A-Z])/\1 \2/g')
sed -i "s|\\\\def\\\\judul{.*}|\\\\def\\\\judul{$JUDUL_MODUL_WITH_SPACES}|" main.tex
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[ENG].tex
pre_compile: |
sed -i 's|% \\input{'${{ matrix.module }}'.tex|\\input{'${{ matrix.module }}'.tex|' main[ENG].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: github-pages
deploy:
name: Deploy
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: merge-artifacts
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: dist
- name: Configure Pages
uses: actions/[email protected]
- uses: actions/upload-pages-artifact@v1
with:
path: dist
- name: Deploy to Pages
id: deployment
uses: actions/[email protected]