Skip to content

Workflow file for this run

name: Continuous Integration and Delivery
on: [push, pull_request]
env:
NODE_VERSION: 20.13.1
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.cache/puppeteer
jobs:
install:
name: 'Installing NPM modules'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Running npm ci (if node_modules not cached)'
uses: actions/cache@v4
id: node-modules-cache
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: npm ci
lint:
name: 'Linting'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run lint
build-solace-message-client:
name: 'Building solace-message-client'
needs: install
runs-on: ubuntu-latest
outputs:
version: ${{ steps.solace-message-client-package-json.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Reading package.json version of solace-message-client'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master
id: solace-message-client-package-json
with:
path: projects/solace-message-client/package.json
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: 'Building solace-message-client'
run: npm run solace-message-client:build
- name: 'Building API Documentation (TypeDoc)'
run: npm run solace-message-client:typedoc
- uses: actions/upload-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- uses: actions/upload-artifact@v3
with:
name: solace-message-client-api
path: dist/solace-message-client-api
build-tryme-app:
name: 'Building TryMe App'
needs: build-solace-message-client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: 'Downloading solace-message-client'
uses: actions/download-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- name: 'Building TryMe App'
run: npm run solace-message-client-testing-app:build
- uses: actions/upload-artifact@v3
with:
name: tryme-app
path: dist/solace-message-client-testing-app/browser
test:
name: 'Unit Testing'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run test:headless
release-guard:
name: 'Release Guard'
if: github.ref == 'refs/heads/master'
needs:
- build-solace-message-client
- build-tryme-app
- lint
- test
runs-on: ubuntu-latest
outputs:
should-release: ${{ steps.tag-release-commit.outputs.is-release-commit }}
steps:
- uses: actions/checkout@v4
- name: 'If release commit present, add release tag'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/tag-release-commit@master
id: tag-release-commit
with:
release-commit-message-pattern: 'release\(solace-message-client\): v(.*)'
expected-version: ${{ needs.build-solace-message-client.outputs.version }}
deploy-api:
name: 'Deploying API (TypeDoc) to GitHub Pages'
if: ${{ needs.release-guard.outputs.should-release == 'true' }}
needs: [ release-guard ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading API'
uses: actions/download-artifact@v3
with:
name: solace-message-client-api
path: dist/api
- name: 'Deploying API to GitHub Pages'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: 'release(api): publish API documentation'
folder: dist
clean: true
clean-exclude: |
tryme
deploy-tryme-app:
name: 'Deploying TryMe App to GitHub Pages'
if: github.ref == 'refs/heads/master'
needs:
- build-solace-message-client
- build-tryme-app
- lint
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading TryMe App'
uses: actions/download-artifact@v3
with:
name: tryme-app
path: dist/tryme
- name: 'Deploying TryMe App to GitHub Pages'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: 'release(tryme): publish TryMe application'
folder: dist
clean: true
clean-exclude: |
api
release:
name: 'Releasing @solace-community/angular-solace-message-client'
if: ${{ needs.release-guard.outputs.should-release == 'true' }}
needs: [ build-solace-message-client, release-guard ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/solace-message-client'
uses: actions/download-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- name: 'Publishing @solace-community/angular-solace-message-client to NPM'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/npm-publish@master
with:
dist-folder: dist/@solace-community/angular-solace-message-client
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}
dry-run: false
- name: 'Creating GitHub Release'
run: gh release create $VERSION --title $VERSION --notes-file CHANGELOG_LATEST.md --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build-solace-message-client.outputs.version }}