Permalink
Browse files

feat: added release history in HTML docs

  • Loading branch information...
maoo committed Oct 23, 2018
1 parent 1c792bc commit 4b1ae4a8d80e4b596975f1a6566a62c9d92284e8
Showing with 55 additions and 5 deletions.
  1. +2 −1 .gitignore
  2. +1 −1 .travis.yml
  3. +3 −0 docs/_config.yml
  4. +12 −0 docs/_layouts/default.html
  5. +5 −0 docs/assets/css/style.scss
  6. +1 −1 package.json
  7. +31 −2 prepare-docs-release.sh
@@ -8,4 +8,5 @@ docs/.sass-cache/
docs/_site/
.DS_Store
docs/.jekyll-metadata
yarn.lock
yarn.lock
gh-pages-docs/
@@ -36,7 +36,7 @@ deploy:
name: $GITHUB_USERNAME
verbose: true
keep-history: true
local-dir: docs
local-dir: gh-pages-docs
target_branch: gh-pages
on:
branch: master
@@ -18,6 +18,9 @@ github:

version: '[[tag]]'

collections:
- tags

links:
- name: Getting Started
url: /
@@ -42,6 +42,18 @@
<div class="column-footer">
<a href="finos.org" target="_blank"><img src="https://www.finos.org/hs-fs/hubfs/sofin%20assets/SOFIN%20LOGOS/FINOS_Icon_Wordmark_White.png" alt="FINOS logo"/></a>
<p>Release: {{ site.version }}</p>
<a class="btn btn-primary" data-toggle="collapse" href="#collapseOldReleases" role="button" aria-expanded="false" aria-controls="collapseExample">
previous releases
</a>
<div class="collapse" id="collapseOldReleases">
<ul class="old-releases">
{% for page in site.pages %}
{% if page.flag == 'tags' %}
<li><a href="/tags/{{ page.name | remove: '.md' }}">{{ page.name | remove: '.md' }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="col-9 main_content">
@@ -60,6 +60,11 @@ ul.column-menu {
margin-left: 40px;
font-size: 18px;
}

ul.old-releases {
list-style: none !important;
}

ul.column-menu li {
margin-bottom: 5px;
list-style: none !important;
@@ -25,7 +25,7 @@
[
"@semantic-release/changelog",
{
"changelogFile": "docs/CHANGELOG.md"
"changelogFile": "docs/CHANGELOG.md.new"
}
],
[
@@ -4,10 +4,39 @@ PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
| sed 's/[",]//g' \
| tr -d '[:space:]')

cp -Rf images/ docs/
GH_REPO_LINE=$(cat package.json | grep repository)
GH_REPO=$(echo ${GH_REPO_LINE#*:} | sed 's/[",]//g' | tr -d '[:space:]')

# Copying images in docs/ folder and patching release version
cp -Rf images/ docs/
sed -i "s/\[\[tag\]\]/$PACKAGE_VERSION/g" docs/_config.yml
echo "---\nflag: tags\n---" > ${PACKAGE_VERSION}.md
echo "Updated _config.yml folder with version '$PACKAGE_VERSION'"

# Pulling contents from gh-pages branch
git clone $GH_REPO gh-pages-docs
cd gh-pages-docs
git checkout gh-pages
rm -rf .git
cd ..
cp -f gh-pages-docs/CHANGELOG.md docs/
echo "Cloned gh-pages branch"

# Append new release notes at the top of CHANGELOG.md
# Check package.json to see how CHANGELOG.md.new is created
echo -e "$(cat docs/CHANGELOG.md.new)\n$(cat docs/CHANGELOG.md)" > docs/CHANGELOG.md
rm -f docs/CHANGELOG.md.new
echo "Updated docs/CHANGELOG.md"

# Copy docs/ contents in a tag-specific subfolder, to allow access to docs history
# Tags are configured as Jekyll collections in _config.yml
mkdir -p gh-pages-docs/tags/$PACKAGE_VERSION
cp -rf docs/* gh-pages-docs/tags/$PACKAGE_VERSION

# Updating gh-pages branch root folder
cp -rf docs/* gh-pages-docs/

echo "Updated _config.yml folder with version '$PACKAGE_VERSION'"

0 comments on commit 4b1ae4a

Please sign in to comment.