Skip to content

Commit

Permalink
fix: auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Feb 9, 2024
1 parent 783dd0e commit d983437
Show file tree
Hide file tree
Showing 4 changed files with 8,450 additions and 51 deletions.
50 changes: 23 additions & 27 deletions .github/workflows/publish-node.js.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Publish
name: Publish npm Package

on:
release:
types: [published]
jobs:
publish:
push:
branches:
- master

jobs:
publish-npm:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
- run: npm version ${{ github.event.release.tag_name }}
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}

# push the version changes to GitHub
- run: git push
env:
# The secret is passed automatically. Nothing to configure.
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
- run: 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:
# The secret is passed automatically. Nothing to configure.
github-token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 12 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
name: Run Tests

on: [push]
on:
push:
branches:
- master
- main
pull_request:
branches:
- '**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 20
- run: npm i
- run: npm run test
- run: npm run test-integration
Loading

0 comments on commit d983437

Please sign in to comment.