Skip to content

Publish

Publish #126

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
version-type:
type: choice
description: Which version type to bump
options:
- patch
- minor
- major
jobs:
publish:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.4
with:
node-version: '18'
- name: Checkout
uses: actions/checkout@v4
- name: Test & Build
run: |
npm install
npm run test-ci
npm run build
- name: Version Bump
id: version-bump
uses: phips28/gh-action-bump-version@v11.0.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: projects/ngx-kel-agent/
with:
tag-prefix: 'v'
# Can't use commit wording because manually dispatched workflows don't contain the commits
version-type: ${{ github.event.inputs.version-type }}
- name: Rebuild
run: |
npm install
npm run build
- name: Publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: dist/ngx-kel-agent/package.json
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.version-bump.outputs.newTag }}
release_name: ${{ steps.version-bump.outputs.newTag }}
- name: Setup git user/email
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Checkout documentation
uses: actions/checkout@v4
with:
ref: doc
path: doc
- name: Generate documentation
run: |
mv doc/.git .docgit
npm run typedoc
mv .docgit doc/.git
- name: Publish documentation
run: |
COMMIT=`git rev-parse --short HEAD`
cd doc
git add -A
git commit -m "Generated documentation at $COMMIT"
git push origin doc