-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (128 loc) · 4.33 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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')
JUDUL_MODUL_WITH_SPACES=$(echo "$JUDUL_MODUL_WITH_SPACES" | sed -r 's/dan/ dan/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/IntroductiontoCLanguage_ENG,
P2/StringArrayBranchingLoop_ENG,
P3/FunctionsandRecursion_ENG,
P4/PointerandStruct_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: |
MODULE_NAME="${{ matrix.module }}"
JUDUL_MODUL=$(echo "$MODULE_NAME" | sed -e 's|.*/||' -e 's|_ENG||')
JUDUL_MODUL_WITH_SPACES=$(echo "$JUDUL_MODUL" | sed -r 's/([a-z])([A-Z])/\1 \2/g')
JUDUL_MODUL_WITH_SPACES=$(echo "$JUDUL_MODUL_WITH_SPACES" | sed -r 's/and/ and/g')
JUDUL_MODUL_WITH_SPACES=$(echo "$JUDUL_MODUL_WITH_SPACES" | sed -r 's/to/ to/g')
sed -i "s|\\\\def\\\\judul{.*}|\\\\def\\\\judul{$JUDUL_MODUL_WITH_SPACES}|" main_ENG.tex
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_ENG.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]