ALPHA Release - v7 - Complete refactoring (#615) #325
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Algoan PubSub Test and Publish Workflow | |
on: | |
push: | |
branches: [ master, alpha ] | |
pull_request: | |
branches: [ master, alpha ] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'Branch, tag or commit SHA1 to build' | |
required: false | |
type: string | |
default: master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
version: [ | |
{ node: "16.x", npm: "8" }, | |
{ node: "18.x", npm: "10" }, | |
{ node: "20.x", npm: "10" } | |
] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.version.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version.node }} | |
cache: 'npm' | |
- name: Get GCloud CLI to install pubsub emulator | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
install_components: beta,pubsub-emulator | |
- run: npm i -g npm@${{ matrix.version.npm }} | |
- run: npm i | |
- name: Type check with TypeScript | |
run: npm run compile -- --noEmit | |
- run: npm run test:cov | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish @algoan/pubsub to NPM | |
needs: | |
- test | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ inputs.ref }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- run: npm i -g npm | |
- run: npm ci | |
- run: npm run compile | |
- run: npm run semantic-release | |
name: Run Semantic Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT_SEMANTIC_RELEASE }} | |
GITHUB_NPM_CONFIG_REGISTRY: https://npm.pkg.github.com/ | |
GITHUB_NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_NPM_CONFIG_REGISTRY: https://registry.npmjs.org/ | |
NPM_NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |