Skip to content

Commit

Permalink
chore: add workflow that tests if tarball is installable
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Feb 28, 2024
1 parent d49ee2d commit 6f57af5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/npm-pack-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: NPM pack check
on:
pull_request:
branches:
- master
jobs:
npm-pack-check:
runs-on: ubuntu-latest
# Only run this job if the PR is from a trusted collaborator (i.e. not a fork)
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
# Checkout project repository
- name: Checkout
uses: actions/checkout@v3.5.0

# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: 20

# Install dependencies so that prepublish scripts work as expected
- name: Install deps
run: npm i

- name: Create test install directory
run: mkdir ../test-install

- name: Ensure pack file can be installed
run: |
export PACK_FILENAME=$(npm pack --json | jq -r '.[] | .filename')
mv $PACK_FILENAME ../test-install/
cd ../test-install
npm install $PACK_FILENAME
node -e "const yates = require('@cerebruminc/yates'); if (typeof yates.setup === 'undefined') { throw new Error('setup export is undefined'); }"
2 changes: 1 addition & 1 deletion .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: 16
node-version: 20

# Use a cache for dependencies
- uses: actions/cache@v3.3.1
Expand Down

0 comments on commit 6f57af5

Please sign in to comment.