Skip to content

Commit

Permalink
feat: run npm test before publish
Browse files Browse the repository at this point in the history
  • Loading branch information
BowTiedDevOps committed Apr 5, 2024
1 parent 31998eb commit 132df19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
CHANGED: ${{steps.check_version.outputs.changed}}
PACKAGE_MANIFEST_PATH: ${{steps.set_path.outputs.changed_manifest_path}}
PACKAGE_PATH: ${{steps.set_path.outputs.changed_path}}
steps:
- name: Checkout Code
id: checkout_code
Expand All @@ -34,6 +34,7 @@ jobs:
if [[ $path == packages/* ]]; then
for manifest in "${manifest_names[@]}"; do
if [[ -f $path/$manifest ]]; then
echo "changed_path=${path}" >> "$GITHUB_OUTPUT"
echo "changed_manifest_path=${path}/${manifest}" >> "$GITHUB_OUTPUT"
echo "package_changed=true" >> "$GITHUB_OUTPUT"
exit 0
Expand Down Expand Up @@ -70,10 +71,17 @@ jobs:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'

- name: Test Package
id: test_package
run: |
cd ${{ needs.check_version_change.outputs.PACKAGE_PATH }}
npm ci
npm test
- name: Publish Package
id: publish_package
uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1
with:
token: ${{ secrets.NODE_AUTH_TOKEN }}
package: ${{ needs.check_version_change.outputs.PACKAGE_MANIFEST_PATH }}
package: ${{ needs.check_version_change.outputs.PACKAGE_PATH }}
access: public
2 changes: 1 addition & 1 deletion packages/bowtieddevops-test-package-6/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bowtieddevops/bowtieddevops-test-package-6",
"version": "1.1.1",
"version": "1.1.6",
"description": "Clarunit, enables writing unit tests in Clarity",
"main": "src/index.ts",
"bin": "src/cli.ts",
Expand Down

0 comments on commit 132df19

Please sign in to comment.