Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Specification Tools
Scripts
Commits
1757192b
Commit
1757192b
authored
1 year ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Renaming index.htm to index.html
parent
f18ab7ed
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
index.html
+0
-0
0 additions, 0 deletions
index.html
publish_on_pages.sh
+9
-2
9 additions, 2 deletions
publish_on_pages.sh
updateIndex.py
+20
-18
20 additions, 18 deletions
updateIndex.py
with
31 additions
and
22 deletions
.gitlab-ci.yml
+
2
−
2
View file @
1757192b
...
...
@@ -87,10 +87,10 @@ pages:
-
|
curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/updateIndex%2Epy/raw?ref=using_pages" >> updateIndex.py
-
|
curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/index%2Ehtm/raw?ref=using_pages" >> index.htm
curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/index%2Ehtm
l
/raw?ref=using_pages" >> index.htm
l
script
:
-
echo 'Publishing on pages'
-
./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $CI_COMMIT_REF_NAME index.htm
-
./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $CI_COMMIT_REF_NAME index.htm
l $CLEAN_WEB_PAGES
artifacts
:
paths
:
-
public
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.htm
→
index.htm
l
+
0
−
0
View file @
1757192b
File moved
This diff is collapsed.
Click to expand it.
publish_on_pages.sh
+
9
−
2
View file @
1757192b
...
...
@@ -17,10 +17,17 @@ if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
set
-e
echo
"------ Add/update content --------"
if
[
$6
==
'true'
]
;
then
echo
'Removing all web pages content...'
rm
-r
public/
*
;
else
ls
public/
fi
mkdir
-p
"public/
$4
"
cp
-r
-f
"
$3_$4
.docx"
public/
$
3
cp
-r
-f
"
$3_$4
.docx"
public/
$
4
docker run
--rm
-
u
$(
id
-u
)
:
$(
id
-g
)
"
$DOCKER_IMAGE
"
$1
"
$3_$4
"
"
$4
/
$3_$4
.docx"
"
$5
"
docker run
--rm
-
v
$(
pwd
)
:/tmp
-w
/tmp
"
$DOCKER_IMAGE
"
pip
install
bs4
&&
python3
$1
"
$3_$4
"
"
$4
/
$3_$4
.docx"
"
$5
"
#echo "<a href="${CI_COMMIT_REF_NAME}/${CI_PROJECT_NAME}_${CI_COMMIT_TAG}.docx" target="_blank">$CI_COMMIT_REF_NAME</a>" >> "public/index.html"
...
...
This diff is collapsed.
Click to expand it.
updateIndex.py
+
20
−
18
View file @
1757192b
...
...
@@ -7,17 +7,18 @@
# License: BSD 3-Clause License. See the LICENSE file for further details.
#
from
bs4
import
BeautifulSoup
import
argparse
,
os
def
updateIndex
(
args
:
argparse
.
Namespace
)
->
None
:
# Check if index.htm exists
if
not
os
.
path
.
exists
(
'
public/index.htm
'
):
print
(
"'
index.htm
'
does not exist yet, using template
"
)
if
not
os
.
path
.
exists
(
'
public/index.htm
l
'
):
print
(
"'
index.htm
l
'
does not exist yet, using template
"
)
with
open
(
args
.
indexTemplate
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
file
:
html_content
=
file
.
read
()
else
:
# Read index HTML
with
open
(
'
index.htm
'
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
file
:
with
open
(
'
public/
index.htm
l
'
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
file
:
html_content
=
file
.
read
()
# Analyze index content with BeautifulSoup
...
...
@@ -28,6 +29,7 @@ def updateIndex(args:argparse.Namespace) -> None:
document_list
=
soup
.
find
(
'
ul
'
,
id
=
'
document-list
'
)
# Add the new element <li> for the new document
if
args
.
documentLink
is
not
None
and
args
.
documentName
is
not
None
:
li
=
soup
.
new_tag
(
'
li
'
)
a
=
soup
.
new_tag
(
'
a
'
,
href
=
args
.
documentLink
)
a
.
string
=
args
.
documentName
...
...
@@ -35,10 +37,10 @@ def updateIndex(args:argparse.Namespace) -> None:
document_list
.
append
(
li
)
# Guarda el archivo HTML actualizado
with
open
(
'
index.htm
'
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
file
:
with
open
(
'
public/
index.htm
l
'
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
file
:
file
.
write
(
str
(
soup
))
print
(
"
Index.htm updated
"
)
print
(
"
Index.htm
l
updated
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment