Skip to content

Commit

Permalink
ci: install pnpm before publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 10, 2024
1 parent 4ff6ddb commit cc2f633
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ jobs:
path: |
~/.dub
~/AppData/Local/dub
~/.pnpm
~/.pnpm-store
D:\.pnpm-store
D:\.pnpm
./.dub
key: "cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-CXX:${{ matrix.compiler }}-${{ hashFiles('./dub.selections.json', './pnpm-lock.yaml')}} }}"
restore-keys: |
Expand Down Expand Up @@ -90,10 +92,18 @@ jobs:
with:
name: minijson-${{ runner.os }}-${{ runner.arch }}
path: ./dist
retention-days: 1

Release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node:
- 20
pnpm:
- 9
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
Expand All @@ -106,7 +116,7 @@ jobs:
name: merged-artifacts
path: dist/

- name: Prepare
- name: Prepare Dist
run: |
chmod +x ./dist/*/minijson
zip -9 -j ./dist/minijson-windows-x64.zip ./dist/win32-x64/minijson.exe
Expand All @@ -116,7 +126,6 @@ jobs:
ls -l ./dist
- name: Draft the release
if: startsWith(github.ref, 'refs/tags/')
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -128,8 +137,22 @@ jobs:
dist/minijson-macos-arm64.tar.gz
dist/minijson-linux-x64.tar.gz
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Setup Pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ matrix.pnpm }}

- name: Install dependencies
run: pnpm install

- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/')
run: pnpm publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"author": "Amin Yahyaabdi",
"main": "./dist/lib.js",
"browser": "./dist/index.html",
"bin": "./dist/cli.js",
"bin": {
"minijson": "dist/cli.js"
},
"files": [
"dist/**/*"
],
Expand All @@ -24,7 +26,7 @@
"format": "prettier -l --cache --write . && pnpm run format.d",
"format.d": "dub run --build=release --quiet dfmt -- --soft_max_line_length 110 --indent_size 2 --inplace ./src ./benchmark",
"lint": "eslint . --fix",
"prepublishOnly": "shx rm -rf ./dist/tsconfig.tsbuildinfo ./dist/*.zip ./dist/*.tar.* ./dist/build.* && chmod +x ./dist/*/minijson",
"prepublishOnly": "shx rm -rf ./dist/tsconfig.tsbuildinfo ./dist/*.zip ./dist/*.tar.* ./dist/build.*",
"start.benchmark.js": "node ./benchmark/js-benchmark.mjs",
"start.benchmark.node": "node ./benchmark/native-benchmark.mjs",
"start.browser": "servor ./dist/ --browse --reload",
Expand Down

0 comments on commit cc2f633

Please sign in to comment.