diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 26b1ce5..4429501 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -3,7 +3,7 @@ name: NPM Package on: push: branches: - - main # Replace with your default branch name if it's different + - main release: types: [created] @@ -18,6 +18,7 @@ jobs: - run: npm ci - run: npm run lint - run: npm test + - run: npm run build version: runs-on: ubuntu-latest @@ -33,12 +34,10 @@ jobs: git config --global user.email "omega@live.co.za" git config --global user.name "Ruan Luies" - run: npm run release - - name: Set Git user - run: | - git config --global user.email "omega@live.co.za" - git config --global user.name "Ruan Luies" - - name: Push changes and tags + - name: Commit and push changes run: | + git add . + git commit -m "chore(release): release new version" git push --follow-tags origin main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -53,7 +52,14 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: npm ci - - run: npm publish + - run: npm run build + - run: npm pack + - name: Extract tarball and publish + run: | + mkdir -p publish + tar -xvf *.tgz -C publish --strip-components 1 + cd publish + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}