Skip to content

Commit 4ecfc0a

Browse files
authored
Merge pull request #414 from iamdarshshah/feat/ci-cd-improvements
feat: CI/CD improvements
2 parents b8fb17f + 4140595 commit 4ecfc0a

File tree

2 files changed

+57
-25
lines changed

2 files changed

+57
-25
lines changed

.github/workflows/publish.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
name: publish on release
1+
name: Publish on Release
22

3-
on: [release]
3+
on:
4+
release:
5+
types: [published]
46

57
jobs:
6-
build:
8+
publish:
79
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
813

914
steps:
10-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v4
1116

12-
- name: install dependencies
13-
run: yarn
17+
- name: Setup Node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20.x
21+
cache: 'yarn'
22+
registry-url: 'https://registry.npmjs.org'
1423

15-
- name: npm publish
16-
run: |
17-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
18-
npm publish || true
24+
- name: Install dependencies
25+
run: yarn install --frozen-lockfile
26+
27+
- name: Build
28+
run: yarn build
29+
30+
- name: Publish to npm
1931
env:
20-
CI: true
2132
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
33+
run: npm publish --access public || true

.github/workflows/push.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,50 @@
1-
name: react-infinite-scroll-component
1+
name: CI
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
47

58
jobs:
69
test:
710
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
node-version: [16.x, 18.x, 20.x]
815

916
steps:
10-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v4
1118

12-
- name: install dependencies
13-
run: yarn
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'yarn'
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
1427

15-
- name: lint
28+
- name: Lint
1629
run: yarn lint
1730

18-
- name: prettier
31+
- name: Prettier check
1932
run: yarn prettier:check
2033

21-
- name: unit tests
22-
run: yarn test
23-
24-
- name: ts type checks
34+
- name: Type check
2535
run: yarn ts-check
2636

27-
- uses: codecov/codecov-action@v1.0.3
37+
- name: Unit tests
38+
run: yarn test --coverage --runInBand
39+
40+
- name: Build package
41+
run: yarn build
42+
43+
- name: Upload coverage to Codecov
44+
if: matrix.node-version == '20.x'
45+
uses: codecov/codecov-action@v4
2846
with:
29-
token: ${{secrets.CODECOV_TOKEN}}
30-
file: ./coverage/lcov.info
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
files: ./coverage/lcov.info
49+
flags: unittests
50+
fail_ci_if_error: false

0 commit comments

Comments
 (0)