Skip to content

Commit

Permalink
Publish latest/next docs in separate job (chartjs#567)
Browse files Browse the repository at this point in the history
* Publish latest/next docs in separate job

* Missing env

* remove if
  • Loading branch information
kurkle authored Dec 16, 2021
1 parent d1c69aa commit 08db403
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Setup and build
run: |
npm ci
Expand All @@ -47,50 +48,64 @@ jobs:
npm pack
env:
VERSION: ${{ needs.setup.outputs.version }}

- 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: 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: Build docs (latest)
if: "!github.event.release.prerelease"

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: |
./scripts/docs-config.sh latest
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: Build docs (next)
if: "github.event.release.prerelease"
run: |
./scripts/docs-config.sh next
npm run docs

- 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

0 comments on commit 08db403

Please sign in to comment.