Skip to content

Commit

Permalink
Merge pull request #177 from gofynd/workflow-add
Browse files Browse the repository at this point in the history
New Action for NPM publish added
  • Loading branch information
paullobofynd authored Sep 26, 2024
2 parents dd63a20 + a977d2c commit cf7d3d6
Show file tree
Hide file tree
Showing 2 changed files with 9,034 additions and 4,310 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: NPM Components Package Publish

on:
push:
branches:
- master-old
workflow_dispatch:
permissions:
contents: write
jobs:
build:
if: contains(github.event.head_commit.message, 'publish-npm')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.18.1]

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: rm -rf package-lock.json && rm -rf dist && npm ci

- name: Update Git Config
run: |
# Modify git config to add user name and email
git config user.name "Paul Lobo (Auto)"
git config user.email "[email protected]"
shell: bash

- name: Bump version
run: npm version patch

- name: Get new version
run: |
npm_version=$(node -p "require('./package.json').version")
echo "NPM_VERSION=$npm_version" >> $GITHUB_ENV
echo "New version: $npm_version" # Add this line to debug
- name: DEBUG STEP
run: echo "$NPM_VERSION"

- name: Build Package
run: npm run build-bundle

- name: Login to npm
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get new version
run: echo "$NPM_VERSION"

- name: Publish Package
run: npm publish

- name: Stage changes
run: git add .

- name: Sync changes
run: git pull

- name: Commit changes
run: |
git add package.json
git commit -m "[Auto] Publish changes to NPM ::: bump version to $(npm version patch)"
- name: Push changes
run: git push
Loading

0 comments on commit cf7d3d6

Please sign in to comment.