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
3c04d717
Commit
3c04d717
authored
1 year ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Using clause 0 from toMkdocs.py script + version handling
parent
d2aba895
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec_on_pages.sh
+44
-18
44 additions, 18 deletions
spec_on_pages.sh
with
44 additions
and
18 deletions
spec_on_pages.sh
+
44
−
18
View file @
3c04d717
...
@@ -39,12 +39,12 @@ git checkout $7
...
@@ -39,12 +39,12 @@ git checkout $7
####### GENERATE NAV SPEC #######
####### GENERATE NAV SPEC #######
echo
"------ Generate input for mkdocs --------"
echo
"------ Generate input for mkdocs --------"
python3
$1
--title
${
9
^^
}
"./
$8
.md"
python3
$1
-it
--title
${
9
^^
}
"./
$8
.md"
echo
"------ Move to docs folder --------"
echo
"------ Move to docs folder --------"
mv
${
9
^^
}
/
*
docs/
mv
${
9
^^
}
/
*
docs/
sed
-i
's/'
${
9
^^
}
'\///g'
_nav.yml
sed
-i
's/'
${
9
^^
}
'\///g'
_nav.yml
cat
_nav.yml
>>
mkdocs.yml
cat
_nav.yml
>>
mkdocs.yml
cp
docs/
1
.md docs/index.md
cp
docs/
0
.md docs/index.md
## Create download tab if official baseline version
## Create download tab if official baseline version
if
[[
${
10
}
==
v
*
]]
;
then
if
[[
${
10
}
==
v
*
]]
;
then
...
@@ -78,30 +78,56 @@ fi
...
@@ -78,30 +78,56 @@ fi
if
[
${
11
}
==
"false"
]
;
then
if
[
${
11
}
==
"false"
]
;
then
echo
"------ Generating site --------"
echo
"------ Generating site --------"
echo
"Generating docs version
${
10
}
..."
echo
"Generating docs version
${
10
}
..."
majorVersion
=
$(
echo
${
10
}
|
grep
-o
v[1-9]
*
\.
|
grep
-o
[
1-9]
*
)
majorVersion
=
$(
echo
${
10
}
|
grep
-o
v[0-9]
*
\.
|
grep
-o
[
0-9]
*
)
interVersion
=
$(
echo
${
10
}
|
cut
-d
.
-f2
)
minorVersion
=
$(
echo
${
10
}
|
cut
-d
.
-f3
)
echo
"Major version is
${
majorVersion
}
"
echo
"Major version is
${
majorVersion
}
"
if
[
-n
"
${
majorVersion
}
"
]
;
then
if
[
-n
"
${
majorVersion
}
"
]
;
then
latest
=
"latestR
${
majorVersion
}
"
latest
=
"latestR
${
majorVersion
}
"
echo
"Handling release
${
latest
}
"
echo
"Handling release
${
latest
}
"
fi
fi
if
[
-z
"
${
majorVersion
}
"
]
||
[
-z
"
${
interVersion
}
"
]
||
[
-z
"
${
minorVersion
}
"
]
;
then
echo
"Deploying non-versioned documents..."
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
${
10
}
else
isPagesSet
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
)
isPagesSet
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
)
if
[
-z
"
${
isPagesSet
}
"
]
;
then
if
[
-z
"
${
isPagesSet
}
"
]
;
then
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
latest
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
latest
mike set-default
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
latest
#That's only needed the first time gl-pages is created
mike set-default
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
latest
#That's only needed the first time gl-pages is created
else
else
latestRelease
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
latest
\,
|
grep
-o
latestR[1-9]
*
)
latestVersionDeployed
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
${
latest
}
|
cut
-d
" "
-f1
)
latestVersionDeployed_inter
=
$(
echo
${
latestVersionDeployed
}
|cut
-d
.
-f2
)
latestVersionDeployed_minor
=
$(
echo
${
latestVersionDeployed
}
|cut
-d
.
-f3
)
latestRelease
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
latest
\,
|
grep
-o
latestR[0-9]
*
)
echo
"Latest release is
${
latestRelease
}
"
echo
"Latest release is
${
latestRelease
}
"
echo
"Latest deployed version for this release is
${
latestVersionDeployed
}
"
##Handling versions: update latestRelease and latest (majorVersion updated)
if
[[
"
${
latest
}
"
>
"
${
latestRelease
}
"
||
"
${
latest
}
"
==
"
${
latestRelease
}
"
]]
;
then
if
[[
"
${
latest
}
"
>
"
${
latestRelease
}
"
||
"
${
latest
}
"
==
"
${
latestRelease
}
"
]]
;
then
echo
"Upgrade latest release..."
echo
"Upgrade latest release...
deploying version
${
10
}
as latest and
${
latest
}
"
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
latest
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
latest
else
else
if
[[
${
latestVersionDeployed_inter
}
<
${
interVersion
}
||
${
latestVersionDeployed_inter
}
==
${
interVersion
}
]]
;
then
if
[[
${
latestVersionDeployed_minor
}
<
${
minorVersion
}
||
${
latestVersionDeployed_minor
}
==
${
minorVersion
}
]]
;
then
echo
"Deploying version
${
10
}
as
${
latest
}
"
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
mike deploy
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
-u
${
10
}
${
latest
}
fi
fi
fi
fi
fi
##Handling versions: hide version with editorial changes (minorVersion updated)
if
[[
${
latestVersionDeployed_inter
}
==
${
interVersion
}
]]
;
then
if
[[
${
latestVersionDeployed_minor
}
<
${
minorVersion
}
]]
;
then
echo
"Hidding version
${
latestVersionDeployed
}
..."
mike props
--deploy-prefix
public
-r
$HTTPS_REMOTE
-p
-b
$PAGES_BRANCH
--set
hidden
=
true
"
${
latestVersionDeployed
}
"
fi
fi
fi
fi
else
else
echo
"------ Removing docs version
${
11
}
..."
echo
"------ Removing docs version
${
11
}
..."
majorVersion
=
$(
echo
${
11
}
|
grep
-o
v[
1
-9]
*
\.
|
grep
-o
[
1
-9]
*
)
majorVersion
=
$(
echo
${
11
}
|
grep
-o
v[
0
-9]
*
\.
|
grep
-o
[
0
-9]
*
)
if
[
-n
"
${
majorVersion
}
"
]
;
then
if
[
-n
"
${
majorVersion
}
"
]
;
then
previousVersion
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
v
${
majorVersion
}
|
grep
-A1
${
11
}
|
grep
-v
${
11
}
)
previousVersion
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
v
${
majorVersion
}
|
grep
-A1
${
11
}
|
grep
-v
${
11
}
)
latest
=
"latestR
${
majorVersion
}
"
latest
=
"latestR
${
majorVersion
}
"
...
@@ -116,11 +142,11 @@ else
...
@@ -116,11 +142,11 @@ else
## Deal with alias latest
## Deal with alias latest
if
[
-n
"
${
isLatest
}
"
]
;
then
if
[
-n
"
${
isLatest
}
"
]
;
then
if
[
-n
"
${
previousVersion
}
"
]
;
then
if
[
-n
"
${
previousVersion
}
"
]
;
then
mike
alias
--deploy-prefix
public
-r
$HTTPS_REMOTE
--allow-empty
-p
-b
$PAGES_BRANCH
-u
${
previousVersion
}
latest
mike
alias
--deploy-prefix
public
-r
$HTTPS_REMOTE
--allow-empty
-p
-b
$PAGES_BRANCH
-u
${
previousVersion
}
${
latest
}
latest
else
else
# Look previous release (previous major version)
# Look previous release (previous major version)
majorVersion
=
$(
echo
$((
--
majorVersion
))
)
majorVersion
=
$(
echo
$((
--
majorVersion
))
)
previousReleaseVersion
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
latestR
${
majorVersion
}
|
grep
-o
v[
1
-9]
*
\.
[
0-9]
*
\.
[
0-9]
*
)
previousReleaseVersion
=
$(
mike list
--deploy-prefix
public
-r
$HTTPS_REMOTE
-b
$PAGES_BRANCH
|
grep
latestR
${
majorVersion
}
|
grep
-o
v[
0
-9]
*
\.
[
0-9]
*
\.
[
0-9]
*
)
echo
"Previous major version is
${
majorVersion
}
"
echo
"Previous major version is
${
majorVersion
}
"
echo
"Previous release version is
${
previousReleaseVersion
}
"
echo
"Previous release version is
${
previousReleaseVersion
}
"
if
[
-n
"
${
previousReleaseVersion
}
"
]
;
then
if
[
-n
"
${
previousReleaseVersion
}
"
]
;
then
...
...
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