Skip to content

Workflow file for this run

name: Hajar CI - @beta
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NPM_PUBLISH_TAG: beta # Specify the tag for publishing
on:
push:
branches: [main]
jobs:
publish-package:
if: ${{!contains(github.event.head_commit.message, 'skip_publish')}}
runs-on: [self-hosted, linux, x64, A01]
strategy:
matrix:
node-version: [21.x]
steps:
- uses: actions/checkout@v4
with:
clean: false
- name: Append -beta to package.json version
run: |
node -e "const fs = require('fs'); const packageJson = require('./package.json'); packageJson.version += '-beta'; fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));"
- uses: actions/setup-node@v2
with:
node-version: 21
registry-url: https://registry.npmjs.org/
always-auth: true
- name: Install dependencies
run: |
if [ -e 'package-lock.json' ]; then
npm ci
else
npm install
fi
- name: Build Library
run: npm run build --if-present
- name: Test & Lint
run: |
npm run test:coverage --if-present
npm run lint --if-present
- name: Publish to NPM @beta tag
run: npm publish --tag $NPM_PUBLISH_TAG
deploy-docs:
if: ${{ contains(github.event.head_commit.message, 'deploy_docs') }}
runs-on: [self-hosted, linux, x64, A01]
strategy:
matrix:
node-version: [21.x]
steps:
- uses: actions/checkout@v2
with:
clean: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Hajar Docs
run: |
rm -fr /home/sikka-hajar/htdocs/hajar.sikka.io || true
cd /var/www/html/sikka-software/_work/Hajar/Hajar/docs
rm -fr package-lock.json || true
rm -fr node_modules || true
npm install
npm run build --if-present
ln -s /var/www/html/sikka-software/_work/Hajar/Hajar/docs /home/sikka-hajar/htdocs/hajar.sikka.io
pm2 stop hajar-docs || true
pm2 delete hajar-docs || true
pm2 start npm --name "hajar-docs" -- start || true
pm2 save || true