Skip to content

Commit

Permalink
Merge pull request #248 from theenadayalank/develop-update-readme-and…
Browse files Browse the repository at this point in the history
…-actions

Updated the github actions and readme
  • Loading branch information
theenadayalank authored Aug 25, 2024
2 parents ebb31bf + db12ae2 commit fcb74a5
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 40 deletions.
51 changes: 25 additions & 26 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
# 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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: NPM Publish
name: Publish to npm

on:
release:
types: [created]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.x'
- run: yarn
- run: yarn test

publish-npm:
needs: test
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn build
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check out the code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install

- name: Build the project
run: yarn build

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn publish --access public

- name: Clean up npm token
run: yarn logout
29 changes: 29 additions & 0 deletions .github/workflows/unit-test-case-on-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run Tests on Release Branch

on:
push:
branches:
- release/**

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run eslint
run: yarn lint

- name: Run tests
run: yarn test
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,35 @@
## Getting Started 🔮

This package will run linters on committed files while pushing the code to remote.
lint-prepush will run linters on the commited files while pushing the code to remote.

### Prerequisites🔭

* This package requires Node.js `>=10`.
* A package to manage git hooks.
* This package requires Node.js `>=18.18.0`.
* A package to manage git hooks. (a tool like [Husky](https://github.com/typicode/husky))

### Installing

#### npm

```bash
npm install --save-dev husky lint-prepush
npm install --save-dev lint-prepush
```

#### using [`yarn`](https://yarnpkg.com/):

```bash
yarn add --dev husky lint-prepush
yarn add --dev lint-prepush
```

### Usage

Configure the following scripts in package.json to lint your committed files 🔧. You can also follow any of the [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) methods to configure lint-prepush.
* Configure the following scripts in package.json to lint your committed files 🔧. You can also follow any of the [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) methods to configure lint-prepush.

* Here [Husky](https://github.com/typicode/husky) is used for managing git hooks.
* pre-push git hook needs to be configured. [Husky](https://github.com/typicode/husky) is a widely used package for managing git hooks.

```diff
{
+ "husky": {
+ "hooks": {
+ "pre-push": "lint-prepush"
+ }
+ },
+ "lint-prepush": {
+ "base": "master",
+ "tasks": {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lint-prepush",
"version": "3.0.0",
"version": "3.0.1",
"description": "Run linters on committed files in a Branch🔬",
"author": "“Theenadayalan” <“puduvai.theena@gmail.com”>",
"license": "MIT",
Expand Down Expand Up @@ -64,6 +64,7 @@
"prepush",
"husky",
"linter",
"git"
"git",
"hooks"
]
}

0 comments on commit fcb74a5

Please sign in to comment.