Publish #136
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 | |
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.2.0 | |
with: | |
node-version: '22' | |
- 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 |