Publish package #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version to bump' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
publishPackage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build | |
- name: Bump version | |
run: | | |
git config --global user.name 'Neogma publisher' | |
git config --global user.email 'themetalfleece@users.noreply.github.com' | |
npm version ${{ inputs.version }} | |
- name: Push | |
run: git push | |
- name: Push tags | |
run: git push --tags | |
- name: Publish to npm | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
publishDocs: | |
needs: publishPackage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install codedoc | |
run: | | |
npm i -g @codedoc/cli | |
- name: Install dependencies | |
run: | | |
cd documentation/.codedoc | |
npm ci | |
- name: Build docs | |
run: | | |
cd documentation | |
codedoc build | |
- name: Move related files to tmp | |
run: | | |
mkdir /tmp/neogma | |
cp -r ./documentation/docs /tmp/neogma/docs | |
cp documentation/index.html /tmp/neogma/index.html | |
cp documentation/favicon.ico /tmp/neogma/favicon.ico | |
- name: Checkout docs | |
uses: actions/checkout@v3 | |
with: | |
ref: docs | |
- name: Push built files | |
run: | | |
rm -rf docs | |
rm -f index.html | |
rm -f favicon.ico | |
cp -r /tmp/neogma/* . | |
git config --global user.name 'Docs builder' | |
git config --global user.email 'themetalfleece@users.noreply.github.com' | |
git add . | |
git commit -m "Build docs" | |
git push --force origin docs |