Skip to content

Commit

Permalink
Publish latest/next docs in separate job (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Mar 24, 2022
1 parent 13b6137 commit e980006
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/publish-npm.yml
Expand Up @@ -42,16 +42,19 @@ jobs:
npm ci
npm run build
npm pack
- name: Publish @next
run: npm publish --tag next
if: "github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

- name: Publish @latest
run: npm publish --tag latest
if: "!github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

- name: Upload chartjs-plugin-zoom.tgz
uses: actions/upload-release-asset@v1
env:
Expand All @@ -61,6 +64,7 @@ jobs:
asset_path: ${{ format('chartjs-plugin-zoom-{0}.tgz', needs.setup.outputs.version) }}
asset_name: ${{ format('chartjs-plugin-zoom-{0}.tgz', needs.setup.outputs.version) }}
asset_content_type: application/gzip

- name: Upload chartjs-plugin-zoom.js
uses: actions/upload-release-asset@v1
env:
Expand All @@ -70,6 +74,7 @@ jobs:
asset_path: dist/chartjs-plugin-zoom.js
asset_name: chartjs-plugin-zoom.js
asset_content_type: application/javascript

- name: Upload chartjs-plugin-zoom.min.js
uses: actions/upload-release-asset@v1
env:
Expand All @@ -79,25 +84,48 @@ jobs:
asset_path: dist/chartjs-plugin-zoom.min.js
asset_name: chartjs-plugin-zoom.min.js
asset_content_type: application/javascript
- name: Build docs

- name: Build docs (version)
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 }}

publish-docs:
needs: [test, setup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Build docs (latest/next)
run: |
npm ci
npm run build
./scripts/docs-config.sh "$VERSION"
npm run docs
env:
VERSION: ${{ 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
Expand Down

0 comments on commit e980006

Please sign in to comment.