Skip to content

Commit

Permalink
Fix npm-publish.yml workflow (#90)
Browse files Browse the repository at this point in the history
Fixes #87

Update `npm-publish.yml` workflow to correctly transpile and publish the application to NPM.

* Add a step to copy `package.json` to the `dist` directory before publishing.
* Modify the `main` and `types` properties in the copied `package.json` to point to the correct files.
  • Loading branch information
EdwinOtten authored Nov 2, 2024
1 parent dc2f1fa commit 332e1a5
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# This workflow builds the package and uploads it to the NPM repository
name: Publish to NPM

# Trigger with every commit on master
on:
push:
branches:
- master

jobs:
build_and_publish_package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Delete node_modules directory
run: rm -rf node_modules

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Publish to npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: dist
# This workflow builds the package and uploads it to the NPM repository
name: Publish to NPM

# Trigger with every commit on master
on:
push:
branches:
- master

jobs:
build_and_publish_package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Delete node_modules directory
run: rm -rf node_modules

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Copy package.json to dist directory
run: cp package.json dist && sed -i 's/\"main\": \".*\"/\"main\": \"sportlink-to-mailchimp-converter.umd.js\"/' dist/package.json && sed -i 's/\"types\": \".*\"/\"types\": \"sportlink-to-mailchimp-converter.umd.d.ts\"/' dist/package.json

- name: Publish to npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: dist

0 comments on commit 332e1a5

Please sign in to comment.