Skip to content

Commit

Permalink
chore: Add pnpm for publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Jun 30, 2024
1 parent 32cb7f4 commit 402f41d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,33 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.4.0

- name: Install Node.js
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org/'
node-version: 20

- name: Run script
run: npm run release
run: pnpm run release
id: version-bump
env:
VERSION_TYPE: ${{ github.event.inputs.type }}
RELEASE_TYPE: ${{ github.event.inputs.release }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: pnpm install

- name: Build CLI
run: npm run build:scripts
run: pnpm run build:scripts

- name: Build Projects
run: npm run build
run: pnpm run build

- name: Create Pre-release
if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate'
Expand All @@ -66,18 +74,18 @@ jobs:

- name: Publish canary
if: github.event.inputs.release == 'canary'
run: npm publish --provenance --access public --workspace axendev-test1 --workspace axendev-test2 --tag canary
run: npm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish release candidate
if: github.event.inputs.release == 'release-candidate'
run: npm publish --provenance --access public --workspace axendev-test1 --workspace axendev-test2 --tag rc
run: npm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode --tag rc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish stable
if: github.event.inputs.release == 'stable'
run: npm publish --provenance --access public --workspace axendev-test1 --workspace axendev-test2
run: pnpm publish --provenance --access public --workspace vitnode-backend --workspace vitnode-frontend --workspace vitnode-shared --workspace create-vitnode-app --workspace eslint-config-vitnode
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 10 additions & 17 deletions bump-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { EOL } from 'os';
import path from 'path';

const ALLOWED_VERSION_TYPES = ['major', 'minor', 'patch'];
const GIT_USER_NAME = process.env.GITHUB_USER || 'Github Action';
const GIT_USER_NAME = process.env.GITHUB_USER || 'Automated Version Bump';
const GIT_USER_EMAIL =
process.env.GITHUB_EMAIL || '[email protected]';
process.env.GITHUB_EMAIL || 'gh-action-bump-version@users.noreply.github.com';
const WORKSPACE = process.env.GITHUB_WORKSPACE;
const EVENT_PATH = process.env.GITHUB_EVENT_PATH;
const VERSION_TYPE = process.env.VERSION_TYPE;
Expand Down Expand Up @@ -233,21 +233,14 @@ function logError(error) {
newVersion = `${tagPrefix}${newVersion}${tagSuffix}`;

// Bump the version
await Promise.all(
packages.map(async pkg => {
await runInWorkspace(
'npm',
[
'version',
'--git-tag-version=false',
'--commit-hooks=false',
'--workspaces-update=false',
newVersion,
],
pkg,
);
}),
);
await runInWorkspace('npm', [
'version',
'--git-tag-version=false',
'--commit-hooks=false',
'--workspaces',
'--workspaces-update=false',
newVersion,
]);

// Expose the new version
await runInWorkspace('sh', [
Expand Down

0 comments on commit 402f41d

Please sign in to comment.