Merge pull request #4 from Universal-Connect-Project/wes/sync #4
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
name: "Auto-publish NPM Package" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
push_to_registry: | |
name: "Setup, and publish" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check for package dir" | |
if: ${{ vars.PACKAGE_DIR == '' }} | |
run: | | |
echo Missing required environment variable | |
exit 1 | |
- name: "Check out the repo" | |
uses: actions/checkout@v4 | |
- name: "Set up Node" | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: "https://registry.npmjs.org" | |
node-version: "lts/*" | |
check-latest: true | |
- name: "Dependencies and tests" | |
run: | | |
npm ci | |
npm run build --workspace ${{ vars.PACKAGE_DIR }} | |
# Remove test files/folders so they aren't published to NPM | |
find ./${{ vars.PACKAGE_DIR }}/dist -name "*.test.*" -delete | |
find ./${{ vars.PACKAGE_DIR }}/dist -name "test" -type d | xargs rm -rf; | |
- name: "Publish to NPM" | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
package: "./${{ vars.PACKAGE_DIR }}/package.json" | |
token: ${{ secrets.NPM_TOKEN }} |