Skip to content

Merge pull request #1106 from JupiterOne/APP-15117 #5203

Merge pull request #1106 from JupiterOne/APP-15117

Merge pull request #1106 from JupiterOne/APP-15117 #5203

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
os: [ubuntu-latest]
steps:
- name: Check out code repository source code
uses: actions/checkout@v4
- id: setup-node
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci --include=optional
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Run tests
run: npm run test:ci
- name: Run build
run: npm run build:dist
# Publishing is done in a separate job to allow
# for all matrix builds to complete.
release:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
strategy:
fail-fast: false
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: npm
registry-url: https://registry.npmjs.org
# Fetch tags and describe the commit before the merge commit
# to see if it's a version publish
- name: Fetch tags
id: tags
run: |
git fetch --tags
if git describe --exact-match --match "v[0-9]*.[0-9]*.[0-9]*" HEAD^2
then
echo "Found version commit tag. Publishing."
echo "publish=true" >> $GITHUB_OUTPUT
else
echo "Version commit tag not found. Not publishing."
fi
- name: Publish
if: steps.tags.outputs.publish == 'true'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
npm ci
npm exec -c "lerna publish from-package --no-verify-access --yes"