Skip to content

Commit

Permalink
change release action to use pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
BolajiOlajide committed Nov 1, 2023
1 parent 03646be commit 72a9036
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'

- name: Load node_modules
uses: actions/cache@v3
Expand All @@ -71,6 +72,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'

- name: Load node_modules
uses: actions/cache@v3
Expand Down Expand Up @@ -100,6 +102,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'

- name: Load node_modules
uses: actions/cache@v3
Expand Down
65 changes: 40 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,56 @@ on:

jobs:
setup:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

if: github.event.inputs.version == 'major' || github.event.inputs.version == 'minor' || github.event.inputs.version == 'patch'

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

- uses: pnpm/action-setup@v2
with:
version: 8

- 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
cache: 'pnpm'

- 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: Install dependencies
run: yarn
run: pnpm install --frozen-lockfile

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

steps:
- uses: actions/checkout@v2
- 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

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

- 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 tests
run: yarn test
- name: Run test for koii
run: pnpm test

publish:
name: "Publish new version"
Expand All @@ -61,21 +71,26 @@ jobs:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

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

- uses: pnpm/action-setup@v2
with:
version: 8

- 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
cache: 'pnpm'

- 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 @@ -85,14 +100,14 @@ jobs:
git config user.email "[email protected]"
- name: Bump to next ${{github.event.inputs.version}} version
run: yarn version --${{github.event.inputs.version}}
run: pnpm version --${{github.event.inputs.version}}

- 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
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: NPM_AUTH_TOKEN

Expand Down

0 comments on commit 72a9036

Please sign in to comment.