Skip to content

Commit

Permalink
Documentation versioning (#596)
Browse files Browse the repository at this point in the history
* Documentation versioning

* Add executable bit
  • Loading branch information
kurkle authored Nov 16, 2021
1 parent b1cbd8a commit b1d2245
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
checks:
if: github.event_name != 'push'
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -18,9 +18,10 @@ jobs:
- name: Test Build
run: |
npm ci
./scripts/docs-config.sh master
npm run docs
gh-release:
if: github.event_name != 'pull_request'
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -30,9 +31,11 @@ jobs:
- name: Build
run: |
npm ci
./scripts/docs-config.sh master
npm run docs
- name: Release to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_AUTH_TOKEN }}
publish_dir: dist/docs
destination_dir: master
26 changes: 26 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,29 @@ jobs:
asset_path: dist/chartjs-plugin-zoom.min.js
asset_name: chartjs-plugin-zoom.min.js
asset_content_type: application/javascript
- name: Build docs
run: |
./scripts/docs-config.sh "$VERSION" release
npm run docs
env:
VERSION: ${{ needs.setup.outputs.version }}
- name: Release to GitHub Pages (version)
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_AUTH_TOKEN }}
publish_dir: dist/docs
destination_dir: ${{ needs.setup.outputs.version }}
- name: Release to GitHub Pages (latest)
if: "!github.event.release.prerelease"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_AUTH_TOKEN }}
publish_dir: dist/docs
destination_dir: latest
- name: Release to GitHub Pages (next)
if: "github.event.release.prerelease"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_AUTH_TOKEN }}
publish_dir: dist/docs
destination_dir: next
44 changes: 43 additions & 1 deletion docs/.vuepress/config.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const base = process.env.MY_PLATFORM === "cloudflare" ? '/' : `/chartjs-plugin-zoom/`;
const docsVersion = "VERSION";
const base = process.env.NODE_ENV === "development" ? '/chartjs-plugin-zoom/master/' : `/chartjs-plugin-zoom/${docsVersion}/`;

module.exports = {
title: 'chartjs-plugin-zoom',
Expand Down Expand Up @@ -30,6 +31,47 @@ module.exports = {
},
},
],
['@simonbrunel/vuepress-plugin-versions', {
filters: {
suffix: (tag) => tag ? ` (${tag})` : '',
title: (v, vars) => window.location.href.includes('master') ? 'Development (master)' : v + (vars.tag ? ` (${tag})` : ''),
},
menu: {
text: '{{version|title}}',
items: [
{
text: 'Documentation',
items: [
{
text: 'Development (master)',
link: '/chartjs-plugin-zoom/master/',
target: '_self',
},
{
type: 'versions',
text: '{{version}}{{tag|suffix}}',
link: '/chartjs-plugin-zoom/{{version}}/',
exclude: /^[0]\.[0-4]\./,
group: 'minor',
target: '_self',
}
]
},
{
text: 'Release notes (5 latest)',
items: [
{
type: 'versions',
limit: 5,
target: '_blank',
group: 'patch',
link: 'https://github.com/chartjs/chartjs-plugin-zoom/releases/tag/v{{version}}'
}
]
}
]
},
}],
],
chainWebpack: (config) => {
config.merge({
Expand Down
160 changes: 160 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
],
"devDependencies": {
"@rollup/plugin-json": "^4.1.0",
"@simonbrunel/vuepress-plugin-versions": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"chart.js": "^3.2.0",
Expand Down
Loading

0 comments on commit b1d2245

Please sign in to comment.