Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
chore: update cicd pipeline to uses pnpm and fix consumer pair (#40)
Browse files Browse the repository at this point in the history
* chore: update cicd pipeline to uses pnpm and fix consumer pair

* update ci action pnpm version

* fix action pnpm again

* fix action again
  • Loading branch information
luongngocminh authored Dec 13, 2023
1 parent 3dfe875 commit 5e973bc
Show file tree
Hide file tree
Showing 16 changed files with 4,014 additions and 6,327 deletions.
28 changes: 18 additions & 10 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
name: 'Setup'
description: "Setups Node.js and npm to run GitHub Actions' jobs."
description: "Setups Node.js and pnpm to run GitHub Actions' jobs."
runs:
using: 'composite'
steps:
- name: 'Setup Node.js'
uses: 'actions/setup-node@v4'
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: 'Setup pnpm'
uses: 'pnpm/action-setup@v2'
with:
version: 8
run_install: false

- name: 'Keep npm cache for future workflows'
uses: 'actions/cache@v3'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
path: '~/.npm'
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: 'Install dependencies'
run: 'npm ci'
run: 'pnpm i'
shell: 'bash'
12 changes: 6 additions & 6 deletions .github/workflows/continuous-integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- name: 'Checkout the repository'
uses: 'actions/checkout@v4'

- name: 'Setup Node.js and npm'
- name: 'Setup Node.js and pnpm'
uses: './.github/actions/setup'

- name: 'Execute the lint script'
run: 'npm run lint'
run: 'pnpm lint'

test:
name: 'Run unit tests with Jest and upload Coverage'
Expand All @@ -27,11 +27,11 @@ jobs:
- name: 'Checkout the repository'
uses: 'actions/checkout@v4'

- name: 'Setup Node.js and npm'
- name: 'Setup Node.js and pnpm'
uses: './.github/actions/setup'

- name: 'Execute the test script'
run: 'npm run test'
run: 'pnpm test'

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -45,8 +45,8 @@ jobs:
- name: 'Checkout the repository'
uses: 'actions/checkout@v4'

- name: 'Setup Node.js and npm'
- name: 'Setup Node.js and pnpm'
uses: './.github/actions/setup'

- name: 'Execute the build script'
run: 'npm run build'
run: 'pnpm build'
8 changes: 4 additions & 4 deletions .github/workflows/publish-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
- name: 'Checkout the repository'
uses: 'actions/checkout@v4'

- name: 'Setup Node.js and npm'
- name: 'Setup Node.js and pnpm'
uses: './.github/actions/setup'

- name: 'Generate package.json'
run: npm run config:prerelease -- ${{ needs.setup.outputs.version }}
run: pnpm config:prerelease -- ${{ needs.setup.outputs.version }}

- name: 'Pack npm package'
run: npm pack
run: pnpm pack

- name: 'Publish to npm'
run: npm publish --tag alpha --access public
run: pnpm publish --tag alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload NPM package file
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
- name: 'Checkout the repository'
uses: 'actions/checkout@v4'

- name: 'Setup Node.js and npm'
- name: 'Setup Node.js and pnpm'
uses: './.github/actions/setup'

- name: 'Generate nightly package.json'
run: npm run config:prerelease -- nightly
run: pnpm config:prerelease -- nightly

- run: npm publish --tag nightly --access public
- run: pnpm publish --tag nightly --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ yarn.lock
.yarnrc
.yarnrc.yaml

# pnpm's lockfile, workspace definitions and hooks.
# We're using npm, and it provides its lockfile and settings.
pnpm-lock.yaml
pnpm-workspace.yaml
pnpmfile.js
# npm's lockfile.
# We're using pnpm, and it provides its lockfile and settings.
package-lock.json

# Log files.
*.log
Expand Down
Loading

0 comments on commit 5e973bc

Please sign in to comment.