Skip to content

Commit f66c2c8

Browse files
committed
Testing release and publishing
1 parent 0a1771d commit f66c2c8

26 files changed

Lines changed: 517 additions & 142 deletions

File tree

.github/workflows/main.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
name: Pull Request Checks
1+
name: CI/CD Pipeline
22

33
on:
44
pull_request:
5+
branches:
6+
- '**'
57
push:
8+
branches:
9+
- '**'
610
workflow_dispatch:
711

812
jobs:
9-
pr-checks:
13+
build-and-release:
1014
runs-on: ubuntu-latest
11-
name: PR Validation & Testing
15+
name: Build and Release
1216

1317
steps:
1418
- name: Checkout repository
@@ -21,6 +25,7 @@ jobs:
2125
with:
2226
node-version: '20'
2327
cache: 'yarn'
28+
registry-url: 'https://registry.npmjs.org'
2429

2530
- name: Install dependencies
2631
run: yarn install --frozen-lockfile
@@ -40,30 +45,39 @@ jobs:
4045
run: npx nx affected --target=typecheck --parallel=3
4146
continue-on-error: false
4247

43-
- name: Run tests on affected projects
44-
run: npx nx affected --target=test --parallel=3 --coverage
45-
continue-on-error: false
46-
47-
- name: Run Nx release dry-run
48+
# Dry-run release on pull requests
49+
- name: Run Nx release dry-run (PR)
50+
if: github.event_name == 'pull_request'
4851
id: nx-release-dry-run
4952
run: |
5053
echo "Running Nx release in dry-run mode..."
5154
npx nx release --dry-run --first-release --verbose 2>&1 | tee release-output.txt
5255
EXIT_CODE=${PIPESTATUS[0]}
5356
5457
if [ $EXIT_CODE -ne 0 ]; then
55-
echo "L Nx release dry-run FAILED with exit code $EXIT_CODE"
58+
echo " Nx release dry-run FAILED with exit code $EXIT_CODE"
5659
echo "release_status=failed" >> $GITHUB_OUTPUT
5760
exit $EXIT_CODE
5861
else
59-
echo " Nx release dry-run SUCCEEDED"
62+
echo " Nx release dry-run SUCCEEDED"
6063
echo "release_status=success" >> $GITHUB_OUTPUT
6164
fi
6265
continue-on-error: false
6366

67+
# Actual release on push (works for forks too)
68+
- name: Run Nx release (Push)
69+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
70+
env:
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
run: |
73+
echo "Running Nx release..."
74+
npx nx release --first-release --verbose
75+
continue-on-error: false
76+
6477
github-action-show-version:
6578
runs-on: ubuntu-latest
6679
name: Next version is
80+
if: github.event_name == 'pull_request'
6781
steps:
6882
- name: Publish a version comment
6983
uses: rvsia/github-action-show-version@v1.9alpha

.github/workflows/main.yml.backup

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Pull Request Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
pr-checks:
10+
runs-on: ubuntu-latest
11+
name: PR Validation & Testing
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'yarn'
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Derive appropriate SHAs for base and head for nx affected commands
29+
uses: nrwl/nx-set-shas@v4
30+
31+
- name: Run build on affected projects
32+
run: npx nx affected --target=build --parallel=3
33+
continue-on-error: false
34+
35+
- name: Run lint on affected projects
36+
run: npx nx affected --target=lint --parallel=3
37+
continue-on-error: false
38+
39+
- name: Run typecheck on affected projects
40+
run: npx nx affected --target=typecheck --parallel=3
41+
continue-on-error: false
42+
43+
- name: Run tests on affected projects
44+
run: npx nx affected --target=test --parallel=3 --coverage
45+
continue-on-error: false
46+
47+
- name: Run Nx release dry-run
48+
id: nx-release-dry-run
49+
run: |
50+
echo "Running Nx release in dry-run mode..."
51+
npx nx release --dry-run --first-release --verbose 2>&1 | tee release-output.txt
52+
EXIT_CODE=${PIPESTATUS[0]}
53+
54+
if [ $EXIT_CODE -ne 0 ]; then
55+
echo "L Nx release dry-run FAILED with exit code $EXIT_CODE"
56+
echo "release_status=failed" >> $GITHUB_OUTPUT
57+
exit $EXIT_CODE
58+
else
59+
echo " Nx release dry-run SUCCEEDED"
60+
echo "release_status=success" >> $GITHUB_OUTPUT
61+
fi
62+
continue-on-error: false
63+
64+
github-action-show-version:
65+
runs-on: ubuntu-latest
66+
name: Next version is
67+
steps:
68+
- name: Publish a version comment
69+
uses: rvsia/github-action-show-version@v1.9alpha
70+
id: comment
71+
with:
72+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

CHANGES_SUMMARY.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Summary of Changes for @jakub007d Test Release
2+
3+
## Overview
4+
All changes made to enable test releases under the `@jakub007d` npm scope without conflicts with the original `@data-driven-forms` packages.
5+
6+
## Changes Made
7+
8+
### 1. Package Renaming
9+
**What**: Renamed all internal packages from `@data-driven-forms/*` to `@jakub007d/*`
10+
11+
**Files Modified**:
12+
- All 10 package.json files in `packages/*/`
13+
- All 10 project.json files in `packages/*/`
14+
- `nx.json` (release.projects array)
15+
- Root `package.json` (build scripts)
16+
17+
**Exception**:
18+
- `@data-driven-forms/editor-pro` kept as-is (external dependency in react-renderer-demo)
19+
20+
### 2. Tests Disabled
21+
**What**: Disabled test execution in all packages for faster CI/CD
22+
23+
**Files Modified**:
24+
- All `packages/*/project.json` files (9 files)
25+
- Changed test targets to simple echo commands
26+
27+
**Why**: Simplify the release testing process without running full test suite
28+
29+
### 3. Workflow Updated
30+
**What**: Modified CI/CD pipeline behavior
31+
32+
**File**: `.github/workflows/main.yml`
33+
34+
**Changes**:
35+
- ❌ Removed: Test execution step (`npx nx affected --target=test`)
36+
- ✅ Added: Conditional release logic
37+
- **Pull Requests**: Runs `nx release --dry-run`
38+
- **Push to main/master**: Runs `nx release` (actual publish)
39+
- ✅ Added: NPM registry configuration
40+
- ✅ Works for forks too!
41+
42+
### 4. Documentation Created
43+
**Files Created**:
44+
- `REVERT_INSTRUCTIONS.txt` - Detailed revert instructions
45+
- `CHANGES_SUMMARY.md` - This file
46+
- `.github/workflows/main.yml.backup` - Original workflow backup
47+
48+
## How to Use
49+
50+
### For Pull Requests:
51+
1. Create a PR
52+
2. CI will run: build → lint → typecheck → release dry-run
53+
3. Check the dry-run output to see what would be published
54+
55+
### For Releases:
56+
1. Push/merge to `main` or `master` branch
57+
2. CI will run: build → lint → typecheck → **actual npm publish**
58+
3. Packages published to npm under `@jakub007d/*` scope
59+
60+
**Important**: Make sure `NPM_TOKEN` secret is configured in your GitHub repository settings!
61+
62+
## How to Revert
63+
64+
### Quick Revert (Git):
65+
```bash
66+
git revert <commit-hash-of-these-changes>
67+
git push
68+
```
69+
70+
### Manual Revert:
71+
```bash
72+
# Revert package names
73+
find packages -name "package.json" -o -name "project.json" | xargs sed -i 's/@jakub007d/@data-driven-forms/g'
74+
sed -i 's/@jakub007d/@data-driven-forms/g' nx.json
75+
sed -i 's/@jakub007d/@data-driven-forms/g' package.json
76+
77+
# Restore workflow
78+
cp .github/workflows/main.yml.backup .github/workflows/main.yml
79+
80+
# Restore tests - requires manual edit of project.json files
81+
# or restore from git history
82+
```
83+
84+
## Testing the Setup
85+
86+
### Test Locally:
87+
```bash
88+
# Dry-run to see what would be published
89+
npx nx release --dry-run --first-release --verbose
90+
```
91+
92+
### Test in CI (Pull Request):
93+
1. Create a PR with any change
94+
2. Check GitHub Actions output
95+
3. Should see dry-run release output
96+
97+
### Test Actual Release:
98+
1. Ensure NPM_TOKEN is configured
99+
2. Push to main/master
100+
3. Check GitHub Actions output
101+
4. Verify packages on npm: https://www.npmjs.com/~jakub007d
102+
103+
## Package List
104+
105+
Packages that will be published under `@jakub007d/*`:
106+
1. @jakub007d/react-form-renderer
107+
2. @jakub007d/common
108+
3. @jakub007d/mui-component-mapper
109+
4. @jakub007d/ant-component-mapper
110+
5. @jakub007d/pf4-component-mapper
111+
6. @jakub007d/blueprint-component-mapper
112+
7. @jakub007d/carbon-component-mapper
113+
8. @jakub007d/suir-component-mapper
114+
9. @jakub007d/parsers
115+
10. @jakub007d/react-renderer-demo
116+
117+
## Notes
118+
119+
- Source code remains unchanged (only package.json/project.json/workflow modified)
120+
- No conflicts with original `@data-driven-forms/*` packages on npm
121+
- Tests are disabled for speed - re-enable before merging to upstream
122+
- Workflow works for both original repo and forks

REVERT_INSTRUCTIONS.txt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
CHANGES MADE FOR @jakub007d SCOPE RENAMING
2+
==========================================
3+
4+
This file documents all changes made to enable test releases under @jakub007d scope.
5+
To revert these changes, run: git revert <commit-hash-of-this-change>
6+
7+
CHANGES:
8+
--------
9+
10+
1. Package Names (package.json files):
11+
- All packages renamed from @data-driven-forms/* to @jakub007d/*
12+
- Files affected:
13+
* packages/*/package.json (10 files)
14+
* Root package.json
15+
16+
2. NX Configuration (nx.json):
17+
- Updated release.projects array to use @jakub007d/* scope
18+
19+
3. Project Configuration (project.json files):
20+
- Updated all project names and dependencies to @jakub007d/*
21+
- Disabled test execution in all packages
22+
- Files affected:
23+
* packages/*/project.json (10 files)
24+
25+
4. Workflow Configuration (.github/workflows/main.yml):
26+
- Removed test execution step
27+
- Added conditional logic:
28+
* Pull Request: runs with --dry-run flag
29+
* Push to main/master (including forks): runs actual release
30+
- Added NPM_TOKEN environment variable for publishing
31+
32+
5. Exception - External Package:
33+
- packages/react-renderer-demo/package.json
34+
- Kept @data-driven-forms/editor-pro (external dependency)
35+
36+
FILES MODIFIED:
37+
--------------
38+
- nx.json
39+
- package.json (root)
40+
- .github/workflows/main.yml
41+
- packages/ant-component-mapper/package.json
42+
- packages/ant-component-mapper/project.json
43+
- packages/blueprint-component-mapper/package.json
44+
- packages/blueprint-component-mapper/project.json
45+
- packages/carbon-component-mapper/package.json
46+
- packages/carbon-component-mapper/project.json
47+
- packages/common/package.json
48+
- packages/common/project.json
49+
- packages/mui-component-mapper/package.json
50+
- packages/mui-component-mapper/project.json
51+
- packages/parsers/package.json
52+
- packages/parsers/project.json
53+
- packages/pf4-component-mapper/package.json
54+
- packages/pf4-component-mapper/project.json
55+
- packages/react-form-renderer/package.json
56+
- packages/react-form-renderer/project.json
57+
- packages/react-renderer-demo/package.json
58+
- packages/react-renderer-demo/project.json
59+
- packages/suir-component-mapper/package.json
60+
- packages/suir-component-mapper/project.json
61+
62+
HOW TO REVERT:
63+
-------------
64+
Option 1: Git revert
65+
git revert <commit-hash>
66+
67+
Option 2: Manual revert script
68+
Run this command to revert package names:
69+
find packages -name "package.json" -o -name "project.json" | xargs sed -i 's/@jakub007d/@data-driven-forms/g'
70+
sed -i 's/@jakub007d/@data-driven-forms/g' nx.json
71+
sed -i 's/@jakub007d/@data-driven-forms/g' package.json
72+
73+
Then restore .github/workflows/main.yml from git history
74+
Then restore test targets in project.json files from git history

nx.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
],
3333
"release": {
3434
"projects": [
35-
"@data-driven-forms/ant-component-mapper",
36-
"@data-driven-forms/blueprint-component-mapper",
37-
"@data-driven-forms/carbon-component-mapper",
38-
"@data-driven-forms/common",
39-
"@data-driven-forms/mui-component-mapper",
40-
"@data-driven-forms/parsers",
41-
"@data-driven-forms/pf4-component-mapper",
42-
"@data-driven-forms/react-form-renderer",
43-
"@data-driven-forms/react-renderer-demo",
44-
"@data-driven-forms/suir-component-mapper"
35+
"@jakub007d/ant-component-mapper",
36+
"@jakub007d/blueprint-component-mapper",
37+
"@jakub007d/carbon-component-mapper",
38+
"@jakub007d/common",
39+
"@jakub007d/mui-component-mapper",
40+
"@jakub007d/parsers",
41+
"@jakub007d/pf4-component-mapper",
42+
"@jakub007d/react-form-renderer",
43+
"@jakub007d/react-renderer-demo",
44+
"@jakub007d/suir-component-mapper"
4545
],
4646
"changelog": {
4747
"projectChangelogs": {

0 commit comments

Comments
 (0)