Skip to content

Commit

Permalink
update ci action to make use of pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
BolajiOlajide committed Nov 1, 2023
1 parent e0ad8f5 commit 5b46afd
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,65 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Use Node.js 14.x
uses: actions/setup-node@v2
- uses: pnpm/action-setup@v2
with:
node-version: 14.x
version: 8

- uses: actions/cache@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'

- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install dependencies
run: yarn
run: pnpm install --frozen-lockfile

lint:
needs: setup
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js 14.x
uses: actions/setup-node@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- name: Load node_modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Run linter for koii
run: yarn lint
run: pnpm lint

test:
needs: setup
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js 14.x
uses: actions/setup-node@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- name: Load node_modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Run test for koii
run: yarn test
run: pnpm test

publish_pre_release:
name: "Publish new alpha version"
Expand All @@ -77,21 +82,21 @@ jobs:
if: github.repository_owner == 'BolajiOlajide' && github.event_name != 'push'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js 14.x
uses: actions/setup-node@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- name: Load node_modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Build
run: yarn build
run: pnpm build

# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
Expand All @@ -101,19 +106,19 @@ jobs:
git config user.email "25608335+BolajiOlajide@users.noreply.github.com"
- name: Bump Prerelease version
run: yarn version --prerelease --preid alpha-${GITHUB_RUN_ID}
run: pnpm version --prerelease --preid alpha-${GITHUB_RUN_ID}

- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master

- name: Publish to NPMJS with yarn
run: yarn publish --access public
- name: Publish to NPMJS with YARN
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: 'Install with: `yarn add koii@${{steps.package-version.outputs.current-version}}`'
message: 'Install with: `pnpm add koii@${{steps.package-version.outputs.current-version}}`'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5b46afd

Please sign in to comment.