diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..651c5a9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: Continuous Integration + +on: + push: + branches: [main] + paths: [src/**, tests/**, package.json] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Installing dependencies โš’๏ธ + run: npm ci + + - name: Running tests ๐Ÿงช + run: npm run test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..5f66256 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,46 @@ +name: Pull Request Check +on: + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Installing dependencies โš’๏ธ + run: npm ci + + - name: Running Tests ๐Ÿงช + run: npm run test + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Installing dependencies โš’๏ธ + run: npm ci + + - name: Checking code quality ๐Ÿค” + run: npm run lint \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..48b05ee --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish to NPM ๐Ÿ“ฆ +on: + release: + types: [created] +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Installing dependencies โš’๏ธ + run: npm ci + + - name: Running tests ๐Ÿงช + run: npm run test + + build: + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies โš’๏ธ + run: npm ci + + - name: Building ๐Ÿ”ง + run: npm run build + + - name: Publish package on NPM ๐Ÿ“ฆ + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 74b1c9e..85442e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "npm-package-template", - "version": "1.2.4", + "version": "1.3.0", "description": "A template for NPM package in Typescript", "main": "./dist/index.js", "module": "./dist/index.mjs",