Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 325/setup nx release monorepo #2726

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .github/workflows/test-publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Under Testing - Publish-packages

on:
push:
branches:
- dev
workflow_call:
inputs:
branch:
type: string
description: "Branch Name on which this action checks out"
required: false
default: "dev"

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
ci-workflow:
uses: ./.github/workflows/ci.yml
packages:
name: packages
runs-on: ubuntu-latest
needs: [ ci-workflow ]
if: ${{ needs.ci-workflow.result=='success' }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.1

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install

- name: Update Packages and Create Release
run: |
pnpm nx release --skip-publish
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

publish_packages:
name: publish-packages
runs-on: ubuntu-latest
needs: [ packages ]
if: ${{ (github.ref=='dev' || inputs.branch=='dev') && needs.packages.result=='success' }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.1

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install

# - name: Update Packages and Create Release
# run: |
# pnpm nx release publish --projects=packages/common,packages/react-pdf-toolkit,sdks/web-ui-sdk,sdks/workflow-browser-sdk,sdks/workflow-node-sdk
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update Packages and Create Release
run: |
pnpm nx release publish --registry https://registry.npmjs.org
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
46 changes: 45 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,49 @@
"dependsOn": [{ "projects": "self", "target": "build" }]
}
},
"defaultBase": "main"
"defaultBase": "main",
"release": {
"projectsRelationship": "independent",
"releaseTagPattern": "{projectName}@{version}",
"conventionalCommits": {
"types": {
"chore": {
"semverBump": "patch"
},
"feat": {
"semverBump": "patch"
},
"fix": {
"semverBump": "patch"
}
}
},
codechirag123 marked this conversation as resolved.
Show resolved Hide resolved
"projects": [
"packages/*",
"sdks/*",
"services/websocket-service",
"services/workflows-service",
"!private"
],
"version": {
"conventionalCommits": true,
"generatorOptions": {
"updateDependents": "auto"
}
},
"changelog": {
"projectChangelogs": {
"renderOptions": {
"authors": true,
"mapAuthorsToGitHubUsernames": true,
"commitReferences": true,
"versionTitleDate": true
},
"createRelease": "github"
},
"workspaceChangelog": {
"createRelease": "github"
}
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"inquirer": "^10.2.0",
"lint-staged": "^11.2.6",
"ngrok": "5.0.0-beta.2",
"nx": "15.0.2",
"@nx/js": "^19.5.7",
"nx": "^19.5.7",
"prettier": "^2.8.7"
},
"dependencies": {
Expand Down