From 2c4224c279e9cde3fa7dd273180bd0101188daf1 Mon Sep 17 00:00:00 2001 From: Ghost Alpha <54934640+ductinhkzz@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:25:28 +0700 Subject: [PATCH] Create pusblish.yml --- .github/workflows/pusblish.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/pusblish.yml diff --git a/.github/workflows/pusblish.yml b/.github/workflows/pusblish.yml new file mode 100644 index 0000000..0e32bec --- /dev/null +++ b/.github/workflows/pusblish.yml @@ -0,0 +1,40 @@ +name: Publish to npm + +on: + release: + types: [published] # Trigger the workflow when a release is published + workflow_dispatch: # Also allow manual triggering + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the repository code + - name: Checkout code + uses: actions/checkout@v3 + + # Step 2: Set up Node.js + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' # Adjust to the version you're using + registry-url: 'https://registry.npmjs.org/' + + # Step 3: Install dependencies + - name: Install dependencies + run: npm install + + # Step 4: Build the package (optional, depending on your library) + - name: Build the package + run: npm run build + + # Step 5: Publish to npm + - name: Publish package + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # Step 6: Push tags to npm (optional if versioning is required) + - name: Push new tag to npm + run: git push --tags