From 94d849a1a2a9ad43ab7d05c7992109053e993f98 Mon Sep 17 00:00:00 2001 From: kobenguyent <7845001+kobenguyent@users.noreply.github.com> Date: Mon, 10 Feb 2025 11:04:13 +0000 Subject: [PATCH 1/3] feat: auto release --- .github/workflows/npm-publish.yml | 46 ++++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 34616dc..9e93dc4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,39 +1,29 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages - -name: Node.js Package +name: Publish npm Package on: - release: - types: [created] + push: + branches: + - master + - main jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm test - publish-npm: - needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 20 registry-url: https://registry.npmjs.org/ - - - name: Get release name - run: echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV - - - name: Update package.json version - run: | - npm version ${{ env.RELEASE_NAME }} --no-git-tag-version - - - run: npm publish + - run: git config --global user.name "GitHub CD bot" + - run: git config --global user.email "github-cd-bot@example.com" + - run: npm i && npm run test && npm run buildcjs + - run: npm config set access public && npx semantic-release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # push the version changes to GitHub + - run: git add package.json && git commit -m'update version' && git push env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + # The secret is passed automatically. Nothing to configure. + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From a3c82b921e102054b041cdba52e1ffe9ee2f42e8 Mon Sep 17 00:00:00 2001 From: kobenguyent <7845001+kobenguyent@users.noreply.github.com> Date: Mon, 10 Feb 2025 12:05:45 +0100 Subject: [PATCH 2/3] fix: Update npm-publish.yml --- .github/workflows/npm-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 9e93dc4..703ac04 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -17,7 +17,7 @@ jobs: registry-url: https://registry.npmjs.org/ - run: git config --global user.name "GitHub CD bot" - run: git config --global user.email "github-cd-bot@example.com" - - run: npm i && npm run test && npm run buildcjs + - run: npm i && npm run test - run: npm config set access public && npx semantic-release env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -26,4 +26,4 @@ jobs: - run: git add package.json && git commit -m'update version' && git push env: # The secret is passed automatically. Nothing to configure. - github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} From 889e1b8442fd6a65e607b0f887a9faadd10068b0 Mon Sep 17 00:00:00 2001 From: kobenguyent <7845001+kobenguyent@users.noreply.github.com> Date: Mon, 10 Feb 2025 12:06:15 +0100 Subject: [PATCH 3/3] fix: Update npm-publish.yml --- .github/workflows/npm-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 703ac04..b787414 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -10,8 +10,8 @@ jobs: publish-npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 20 registry-url: https://registry.npmjs.org/