@alex_neo/playwright-azure-reporter 1.13.1 → 1.13.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.beta-release.json +21 -0
- package/.github/copilot-instructions.md +178 -0
- package/.github/workflows/beta-release.yml +220 -0
- package/.github/workflows/pr-beta-release.yml +345 -0
- package/.github/workflows/publish.yml +132 -5
- package/CHANGELOG.md +41 -0
- package/README.md +4 -0
- package/RELEASES.md +151 -0
- package/package.json +3 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"betaRelease": {
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"branches": ["main"],
|
|
5
|
+
"versionStrategy": "patch",
|
|
6
|
+
"publishTag": "beta",
|
|
7
|
+
"createGitHubRelease": true,
|
|
8
|
+
"prBetaRelease": {
|
|
9
|
+
"enabled": true,
|
|
10
|
+
"versionStrategy": "patch",
|
|
11
|
+
"publishTag": "pr-beta",
|
|
12
|
+
"createGitHubRelease": false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"stableRelease": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"versionStrategy": "patch",
|
|
18
|
+
"publishTag": "latest",
|
|
19
|
+
"createGitHubRelease": true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Playwright Azure Reporter
|
|
2
|
+
|
|
3
|
+
Playwright Azure Reporter is a TypeScript package that creates a Playwright reporter for integrating test results with Azure DevOps Test Plans. It allows publishing test results directly to Azure DevOps using test case IDs embedded in test names or annotations.
|
|
4
|
+
|
|
5
|
+
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
|
|
6
|
+
|
|
7
|
+
## CRITICAL: Timeout Requirements
|
|
8
|
+
|
|
9
|
+
**NEVER CANCEL LONG-RUNNING COMMANDS**. This repository has specific timing requirements:
|
|
10
|
+
|
|
11
|
+
- **Dependencies**: `yarn install` - 60+ second timeout required
|
|
12
|
+
- **Build**: `yarn build` - 30+ second timeout required
|
|
13
|
+
- **Tests**: `yarn test:reporter` - 120+ second timeout required (59 tests)
|
|
14
|
+
- **Complete workflow**: 180+ second timeout required for full validation
|
|
15
|
+
- **Browser installation**: Will fail due to network issues - document but continue
|
|
16
|
+
|
|
17
|
+
**Set explicit timeouts for ALL commands to prevent premature cancellation.**
|
|
18
|
+
|
|
19
|
+
## Working Effectively
|
|
20
|
+
|
|
21
|
+
- **Bootstrap the repository:**
|
|
22
|
+
- `yarn install --ignore-engines` - Installs all dependencies. Takes ~15 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
|
|
23
|
+
- `npx playwright install` - Installs Playwright browsers. May fail due to network issues - document if it fails.
|
|
24
|
+
|
|
25
|
+
- **Build the project:**
|
|
26
|
+
- `yarn build` - Full build (clean + lint + TypeScript compile). Takes ~8 seconds. NEVER CANCEL. Set timeout to 30+ seconds.
|
|
27
|
+
- `yarn clean` - Removes dist/ directory. Takes <1 second.
|
|
28
|
+
- `yarn dev` - Development build (lint + TypeScript compile). Takes ~8 seconds. Set timeout to 30+ seconds.
|
|
29
|
+
|
|
30
|
+
- **Run tests:**
|
|
31
|
+
- `yarn test:reporter` - Run reporter unit tests. Takes ~50 seconds (59 tests). NEVER CANCEL. Set timeout to 120+ seconds.
|
|
32
|
+
- `yarn test` - Run example integration tests. REQUIRES Playwright browsers to be installed.
|
|
33
|
+
|
|
34
|
+
- **Code quality:**
|
|
35
|
+
- `yarn lint` - Type check and ESLint validation. Takes ~3 seconds. Set timeout to 30+ seconds.
|
|
36
|
+
- `yarn lint:fix` - Auto-fix ESLint issues. Takes ~2 seconds. Set timeout to 30+ seconds.
|
|
37
|
+
- `yarn format` - Format code with Prettier. Takes ~1.5 seconds. Set timeout to 30+ seconds.
|
|
38
|
+
|
|
39
|
+
## Validation
|
|
40
|
+
|
|
41
|
+
- **ALWAYS run the reporter test suite after making changes:**
|
|
42
|
+
- `yarn test:reporter` validates the core reporter functionality without requiring browser installation
|
|
43
|
+
- These tests cover all reporter modes, configuration validation, and Azure DevOps integration logic
|
|
44
|
+
- Set timeout to 120+ seconds as tests take ~50 seconds to complete
|
|
45
|
+
|
|
46
|
+
- **Test the example suite only if browsers are available:**
|
|
47
|
+
- The main test suite (`yarn test`) requires Playwright browsers and demonstrates Azure DevOps test case ID formats
|
|
48
|
+
- If browsers fail to install due to network issues, document this but don't let it block your work
|
|
49
|
+
|
|
50
|
+
- **ALWAYS run code quality checks before completing changes:**
|
|
51
|
+
- `yarn lint` - Type checking and linting (required for CI). Takes ~3 seconds. Set timeout to 30+ seconds.
|
|
52
|
+
- `yarn format` - Code formatting (required for CI). Takes ~1.5 seconds. Set timeout to 30+ seconds.
|
|
53
|
+
- These are enforced by the pre-commit hook and CI pipeline
|
|
54
|
+
|
|
55
|
+
- **Complete development workflow validation:**
|
|
56
|
+
- Full workflow: `yarn build && yarn test:reporter && yarn lint && yarn format`
|
|
57
|
+
- Takes ~63 seconds total. NEVER CANCEL. Set timeout to 180+ seconds.
|
|
58
|
+
|
|
59
|
+
## Playwright Browser Installation Issues
|
|
60
|
+
|
|
61
|
+
- **KNOWN ISSUE**: `npx playwright install` consistently fails with network timeouts or download failures
|
|
62
|
+
- **Error signature**: "Download failed: size mismatch" or "Download failure, code=1"
|
|
63
|
+
- **Impact**: Only affects the example integration tests (`yarn test`), not core development
|
|
64
|
+
- **Workaround**: Continue development without browsers - the reporter tests cover all functionality
|
|
65
|
+
- **Resolution**: Document the failure but do not let it block development work
|
|
66
|
+
|
|
67
|
+
## Common Tasks
|
|
68
|
+
|
|
69
|
+
### Building and Testing Workflow
|
|
70
|
+
```bash
|
|
71
|
+
# Complete development workflow (takes ~63 seconds total)
|
|
72
|
+
yarn install --ignore-engines # ~15 seconds, timeout: 60+ seconds
|
|
73
|
+
yarn build # ~8 seconds, timeout: 30+ seconds
|
|
74
|
+
yarn test:reporter # ~50 seconds, timeout: 120+ seconds
|
|
75
|
+
yarn lint # ~3 seconds, timeout: 30+ seconds
|
|
76
|
+
yarn format # ~1.5 seconds, timeout: 30+ seconds
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Code Quality Validation
|
|
80
|
+
```bash
|
|
81
|
+
# Before committing (enforced by pre-commit hook)
|
|
82
|
+
yarn lint # Type checking + ESLint - ~3 seconds
|
|
83
|
+
yarn lint:fix # Auto-fix linting issues - ~2 seconds
|
|
84
|
+
yarn format # Format with Prettier - ~1.5 seconds
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Development Mode
|
|
88
|
+
```bash
|
|
89
|
+
# Watch mode requires nodemon to be installed globally
|
|
90
|
+
yarn dev:watch # Auto-rebuild on file changes (if nodemon available)
|
|
91
|
+
# Alternative: Run yarn dev manually after changes
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Repository Structure
|
|
95
|
+
|
|
96
|
+
### Source Code (`src/`)
|
|
97
|
+
- `playwright-azure-reporter.ts` - Main reporter implementation
|
|
98
|
+
- `logger.ts` - Logging utilities
|
|
99
|
+
- `utils.ts` - Helper functions
|
|
100
|
+
|
|
101
|
+
### Tests (`tests/`)
|
|
102
|
+
- `tests/reporter/` - Comprehensive reporter unit tests (59 tests)
|
|
103
|
+
- `tests/example.spec.ts` - Example integration tests showing test case ID formats
|
|
104
|
+
- `tests/config/` - Test configuration and fixtures
|
|
105
|
+
|
|
106
|
+
### Key Files
|
|
107
|
+
- `package.json` - Dependencies and scripts
|
|
108
|
+
- `tsconfig.json` - TypeScript configuration
|
|
109
|
+
- `playwright.config.ts` - Main Playwright configuration (requires Azure DevOps environment variables)
|
|
110
|
+
- `tests/reporter/playwright.config.ts` - Reporter test configuration
|
|
111
|
+
- `.eslintrc.js` - ESLint configuration
|
|
112
|
+
- `.prettierrc` - Prettier configuration
|
|
113
|
+
|
|
114
|
+
## Configuration Requirements
|
|
115
|
+
|
|
116
|
+
### For Integration Testing
|
|
117
|
+
The reporter requires Azure DevOps environment variables:
|
|
118
|
+
- `AZURE_PW_ORGURL` - Azure DevOps organization URL
|
|
119
|
+
- `AZURE_PW_TOKEN` - Personal access token
|
|
120
|
+
- `AZURE_PW_PLANID` - Test plan ID
|
|
121
|
+
- `AZURE_PW_PROJECTNAME` - Project name
|
|
122
|
+
|
|
123
|
+
### Test Case ID Formats
|
|
124
|
+
The reporter supports multiple test case ID formats:
|
|
125
|
+
- `[1] Test name` - Single test case
|
|
126
|
+
- `[1,2,3] Test name` - Multiple test cases
|
|
127
|
+
- `[1, 2, 3] Test name` - Multiple with spaces
|
|
128
|
+
- Tag format: `test('Test name', { tag: ['@[1]'] })`
|
|
129
|
+
|
|
130
|
+
## CI/CD Integration
|
|
131
|
+
|
|
132
|
+
- **GitHub Actions**: Uses `tests.yml` workflow
|
|
133
|
+
- **Pre-commit hooks**: Automatically runs `yarn lint`
|
|
134
|
+
- **Required Node.js**: Version 18+
|
|
135
|
+
- **Package manager**: Yarn (uses yarn.lock)
|
|
136
|
+
|
|
137
|
+
## Development Notes
|
|
138
|
+
|
|
139
|
+
- **TypeScript compilation**: Outputs to `dist/` directory with source maps and type definitions
|
|
140
|
+
- **Husky**: Git hooks are configured (install with `yarn install`)
|
|
141
|
+
- **Testing strategy**: Unit tests cover reporter logic, integration tests demonstrate usage
|
|
142
|
+
- **Build artifacts**: JavaScript files, type definitions, and source maps in `dist/`
|
|
143
|
+
|
|
144
|
+
## Validation Scenarios
|
|
145
|
+
|
|
146
|
+
After making changes to the reporter:
|
|
147
|
+
|
|
148
|
+
1. **Core functionality validation:**
|
|
149
|
+
```bash
|
|
150
|
+
yarn build && yarn test:reporter # Validates all reporter features
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
2. **Code quality validation:**
|
|
154
|
+
```bash
|
|
155
|
+
yarn lint && yarn format # Required for CI to pass
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
3. **Integration testing (if browsers available):**
|
|
159
|
+
```bash
|
|
160
|
+
yarn test # Tests example scenarios with test case IDs
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Common File Locations
|
|
164
|
+
|
|
165
|
+
### Frequently Modified Files
|
|
166
|
+
- `src/playwright-azure-reporter.ts` - Main reporter logic
|
|
167
|
+
- `tests/reporter/*.spec.ts` - Test files for specific features
|
|
168
|
+
- `package.json` - Dependencies and version updates
|
|
169
|
+
|
|
170
|
+
### Configuration Files
|
|
171
|
+
- `.eslintrc.js` - Linting rules
|
|
172
|
+
- `tsconfig.json` - TypeScript settings
|
|
173
|
+
- `playwright.config.ts` - Example configuration
|
|
174
|
+
|
|
175
|
+
### Generated Files (Do Not Edit)
|
|
176
|
+
- `dist/` - Built JavaScript and type definitions
|
|
177
|
+
- `test-results/` - Test output artifacts
|
|
178
|
+
- `node_modules/` - Dependencies
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
name: Beta Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- develop
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
branch:
|
|
11
|
+
description: 'Branch to release from (optional, defaults to main)'
|
|
12
|
+
required: false
|
|
13
|
+
default: 'main'
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check-pr-merge:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
outputs:
|
|
19
|
+
is-pr-merge: ${{ steps.check.outputs.is-pr-merge }}
|
|
20
|
+
pr-number: ${{ steps.check.outputs.pr-number }}
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 2
|
|
26
|
+
|
|
27
|
+
- name: Check if this is a PR merge
|
|
28
|
+
id: check
|
|
29
|
+
run: |
|
|
30
|
+
# Get the commit message of the current commit
|
|
31
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
32
|
+
echo "Commit message: $COMMIT_MSG"
|
|
33
|
+
|
|
34
|
+
# Check if it's a merge commit from a PR
|
|
35
|
+
if [[ "$COMMIT_MSG" =~ ^Merge\ pull\ request\ #([0-9]+) ]]; then
|
|
36
|
+
echo "is-pr-merge=true" >> $GITHUB_OUTPUT
|
|
37
|
+
PR_NUMBER=$(echo "$COMMIT_MSG" | sed -n 's/^Merge pull request #\([0-9]*\).*/\1/p')
|
|
38
|
+
echo "pr-number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
|
39
|
+
echo "This is a PR merge commit (PR #$PR_NUMBER)"
|
|
40
|
+
else
|
|
41
|
+
echo "is-pr-merge=false" >> $GITHUB_OUTPUT
|
|
42
|
+
echo "This is not a PR merge commit"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
beta-release:
|
|
46
|
+
needs: check-pr-merge
|
|
47
|
+
if: needs.check-pr-merge.outputs.is-pr-merge == 'true' || github.event_name == 'workflow_dispatch'
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
permissions:
|
|
50
|
+
contents: write
|
|
51
|
+
packages: write
|
|
52
|
+
steps:
|
|
53
|
+
- name: Checkout
|
|
54
|
+
uses: actions/checkout@v4
|
|
55
|
+
with:
|
|
56
|
+
ref: ${{ github.event.inputs.branch || 'main' }}
|
|
57
|
+
fetch-depth: 0
|
|
58
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
59
|
+
|
|
60
|
+
- name: Load beta release configuration
|
|
61
|
+
id: config
|
|
62
|
+
run: |
|
|
63
|
+
if [ -f ".beta-release.json" ]; then
|
|
64
|
+
echo "Configuration file found"
|
|
65
|
+
ENABLED=$(jq -r '.betaRelease.enabled // true' .beta-release.json)
|
|
66
|
+
BRANCHES=$(jq -r '.betaRelease.branches // ["main"] | join(",")' .beta-release.json)
|
|
67
|
+
VERSION_STRATEGY=$(jq -r '.betaRelease.versionStrategy // "patch"' .beta-release.json)
|
|
68
|
+
PUBLISH_TAG=$(jq -r '.betaRelease.publishTag // "beta"' .beta-release.json)
|
|
69
|
+
CREATE_GITHUB_RELEASE=$(jq -r '.betaRelease.createGitHubRelease // true' .beta-release.json)
|
|
70
|
+
|
|
71
|
+
echo "enabled=$ENABLED" >> $GITHUB_OUTPUT
|
|
72
|
+
echo "branches=$BRANCHES" >> $GITHUB_OUTPUT
|
|
73
|
+
echo "version-strategy=$VERSION_STRATEGY" >> $GITHUB_OUTPUT
|
|
74
|
+
echo "publish-tag=$PUBLISH_TAG" >> $GITHUB_OUTPUT
|
|
75
|
+
echo "create-github-release=$CREATE_GITHUB_RELEASE" >> $GITHUB_OUTPUT
|
|
76
|
+
|
|
77
|
+
echo "Beta release enabled: $ENABLED"
|
|
78
|
+
echo "Configured branches: $BRANCHES"
|
|
79
|
+
echo "Current branch: ${{ github.ref_name }}"
|
|
80
|
+
|
|
81
|
+
# Check if current branch is in the allowed branches
|
|
82
|
+
IFS=',' read -ra BRANCH_ARRAY <<< "$BRANCHES"
|
|
83
|
+
BRANCH_ALLOWED=false
|
|
84
|
+
for branch in "${BRANCH_ARRAY[@]}"; do
|
|
85
|
+
if [[ "${{ github.ref_name }}" == "$branch" ]]; then
|
|
86
|
+
BRANCH_ALLOWED=true
|
|
87
|
+
break
|
|
88
|
+
fi
|
|
89
|
+
done
|
|
90
|
+
echo "branch-allowed=$BRANCH_ALLOWED" >> $GITHUB_OUTPUT
|
|
91
|
+
else
|
|
92
|
+
echo "No configuration file found, using defaults"
|
|
93
|
+
echo "enabled=true" >> $GITHUB_OUTPUT
|
|
94
|
+
echo "branches=main" >> $GITHUB_OUTPUT
|
|
95
|
+
echo "version-strategy=patch" >> $GITHUB_OUTPUT
|
|
96
|
+
echo "publish-tag=beta" >> $GITHUB_OUTPUT
|
|
97
|
+
echo "create-github-release=true" >> $GITHUB_OUTPUT
|
|
98
|
+
echo "branch-allowed=true" >> $GITHUB_OUTPUT
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
- name: Check if beta release should proceed
|
|
102
|
+
if: steps.config.outputs.enabled != 'true' || steps.config.outputs.branch-allowed != 'true'
|
|
103
|
+
run: |
|
|
104
|
+
echo "Beta release is disabled or branch not allowed for beta releases"
|
|
105
|
+
echo "Enabled: ${{ steps.config.outputs.enabled }}"
|
|
106
|
+
echo "Branch allowed: ${{ steps.config.outputs.branch-allowed }}"
|
|
107
|
+
exit 0
|
|
108
|
+
|
|
109
|
+
- name: Setup Node.js
|
|
110
|
+
uses: actions/setup-node@v4
|
|
111
|
+
with:
|
|
112
|
+
node-version: '>=18'
|
|
113
|
+
registry-url: 'https://registry.npmjs.org'
|
|
114
|
+
scope: '@alex_neo'
|
|
115
|
+
|
|
116
|
+
- name: Configure Git
|
|
117
|
+
run: |
|
|
118
|
+
git config user.name "github-actions[bot]"
|
|
119
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
120
|
+
|
|
121
|
+
- name: Install dependencies
|
|
122
|
+
run: yarn --ignore-engines
|
|
123
|
+
|
|
124
|
+
- name: Build project
|
|
125
|
+
run: yarn build
|
|
126
|
+
|
|
127
|
+
- name: Generate beta version
|
|
128
|
+
id: version
|
|
129
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
130
|
+
run: |
|
|
131
|
+
# Get current version
|
|
132
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
133
|
+
echo "Current version: $CURRENT_VERSION"
|
|
134
|
+
|
|
135
|
+
VERSION_STRATEGY="${{ steps.config.outputs.version-strategy }}"
|
|
136
|
+
echo "Version strategy: $VERSION_STRATEGY"
|
|
137
|
+
|
|
138
|
+
# Check if current version is already a beta
|
|
139
|
+
if [[ "$CURRENT_VERSION" =~ -beta\. ]]; then
|
|
140
|
+
# If it's already a beta, increment the beta number
|
|
141
|
+
BETA_NUMBER=$(echo "$CURRENT_VERSION" | sed -n 's/.*-beta\.\([0-9]*\).*/\1/p')
|
|
142
|
+
NEW_BETA_NUMBER=$((BETA_NUMBER + 1))
|
|
143
|
+
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-beta\.[0-9]*$//')
|
|
144
|
+
NEW_VERSION="$BASE_VERSION-beta.$NEW_BETA_NUMBER"
|
|
145
|
+
else
|
|
146
|
+
# If it's not a beta, create a new beta version based on strategy
|
|
147
|
+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
|
148
|
+
MAJOR=${VERSION_PARTS[0]}
|
|
149
|
+
MINOR=${VERSION_PARTS[1]}
|
|
150
|
+
PATCH=${VERSION_PARTS[2]}
|
|
151
|
+
|
|
152
|
+
case $VERSION_STRATEGY in
|
|
153
|
+
"major")
|
|
154
|
+
NEW_MAJOR=$((MAJOR + 1))
|
|
155
|
+
NEW_VERSION="$NEW_MAJOR.0.0-beta.0"
|
|
156
|
+
;;
|
|
157
|
+
"minor")
|
|
158
|
+
NEW_MINOR=$((MINOR + 1))
|
|
159
|
+
NEW_VERSION="$MAJOR.$NEW_MINOR.0-beta.0"
|
|
160
|
+
;;
|
|
161
|
+
*)
|
|
162
|
+
NEW_PATCH=$((PATCH + 1))
|
|
163
|
+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH-beta.0"
|
|
164
|
+
;;
|
|
165
|
+
esac
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
echo "New version: $NEW_VERSION"
|
|
169
|
+
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
170
|
+
|
|
171
|
+
# Update package.json version
|
|
172
|
+
npm version "$NEW_VERSION" --no-git-tag-version
|
|
173
|
+
|
|
174
|
+
- name: Update changelog
|
|
175
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
176
|
+
run: |
|
|
177
|
+
# Generate changelog for the new beta version
|
|
178
|
+
npx conventional-changelog -p angular -i CHANGELOG.md -s --first-release
|
|
179
|
+
|
|
180
|
+
- name: Commit version changes
|
|
181
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
182
|
+
run: |
|
|
183
|
+
git add package.json CHANGELOG.md
|
|
184
|
+
git commit -m "chore: release v${{ steps.version.outputs.new-version }}"
|
|
185
|
+
git tag "v${{ steps.version.outputs.new-version }}"
|
|
186
|
+
|
|
187
|
+
- name: Push changes
|
|
188
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
189
|
+
run: |
|
|
190
|
+
git push origin ${{ github.event.inputs.branch || 'main' }}
|
|
191
|
+
git push origin "v${{ steps.version.outputs.new-version }}"
|
|
192
|
+
|
|
193
|
+
- name: Build for publishing
|
|
194
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
195
|
+
run: yarn build
|
|
196
|
+
|
|
197
|
+
- name: Publish to npm
|
|
198
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true'
|
|
199
|
+
run: yarn publish --access public --tag ${{ steps.config.outputs.publish-tag }}
|
|
200
|
+
env:
|
|
201
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
202
|
+
|
|
203
|
+
- name: Create GitHub Release
|
|
204
|
+
if: steps.config.outputs.enabled == 'true' && steps.config.outputs.branch-allowed == 'true' && steps.config.outputs.create-github-release == 'true'
|
|
205
|
+
run: |
|
|
206
|
+
gh release create "v${{ steps.version.outputs.new-version }}" \
|
|
207
|
+
--title "Release v${{ steps.version.outputs.new-version }}" \
|
|
208
|
+
--notes "🎉 **Beta Release v${{ steps.version.outputs.new-version }}**
|
|
209
|
+
|
|
210
|
+
This is an automated beta release triggered by merging PR #${{ needs.check-pr-merge.outputs.pr-number || 'manual' }}.
|
|
211
|
+
|
|
212
|
+
**Installation:**
|
|
213
|
+
\`\`\`bash
|
|
214
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.config.outputs.publish-tag }}
|
|
215
|
+
\`\`\`
|
|
216
|
+
|
|
217
|
+
**Note:** This is a beta release for testing purposes. For production use, please use the latest stable release." \
|
|
218
|
+
--prerelease
|
|
219
|
+
env:
|
|
220
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
name: PR Beta Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize]
|
|
6
|
+
issue_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
check-conditions:
|
|
11
|
+
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
outputs:
|
|
14
|
+
should-release: ${{ steps.check.outputs.should-release }}
|
|
15
|
+
pr-number: ${{ steps.check.outputs.pr-number }}
|
|
16
|
+
pr-head-ref: ${{ steps.check.outputs.pr-head-ref }}
|
|
17
|
+
pr-head-sha: ${{ steps.check.outputs.pr-head-sha }}
|
|
18
|
+
steps:
|
|
19
|
+
- name: Check comment and PR conditions
|
|
20
|
+
id: check
|
|
21
|
+
env:
|
|
22
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
23
|
+
run: |
|
|
24
|
+
# Check if comment contains beta release trigger
|
|
25
|
+
COMMENT_BODY="${{ github.event.comment.body }}"
|
|
26
|
+
if [[ "$COMMENT_BODY" =~ /beta-release|/release-beta ]]; then
|
|
27
|
+
echo "Beta release comment detected"
|
|
28
|
+
|
|
29
|
+
# Check if the commenter is the repository owner or has write access
|
|
30
|
+
COMMENT_USER="${{ github.event.comment.user.login }}"
|
|
31
|
+
REPO_OWNER="${{ github.repository_owner }}"
|
|
32
|
+
|
|
33
|
+
echo "Comment user: $COMMENT_USER"
|
|
34
|
+
echo "Repository owner: $REPO_OWNER"
|
|
35
|
+
|
|
36
|
+
# Check if user is the repository owner
|
|
37
|
+
if [[ "$COMMENT_USER" == "$REPO_OWNER" ]]; then
|
|
38
|
+
echo "User is repository owner - access granted"
|
|
39
|
+
HAS_PERMISSION=true
|
|
40
|
+
else
|
|
41
|
+
# Check if user has write permissions to the repository
|
|
42
|
+
PERMISSION_RESPONSE=$(gh api repos/${{ github.repository }}/collaborators/$COMMENT_USER/permission || echo '{"permission":"none"}')
|
|
43
|
+
USER_PERMISSION=$(echo "$PERMISSION_RESPONSE" | jq -r .permission)
|
|
44
|
+
echo "User permission level: $USER_PERMISSION"
|
|
45
|
+
|
|
46
|
+
if [[ "$USER_PERMISSION" == "admin" || "$USER_PERMISSION" == "write" ]]; then
|
|
47
|
+
echo "User has write/admin permissions - access granted"
|
|
48
|
+
HAS_PERMISSION=true
|
|
49
|
+
else
|
|
50
|
+
echo "User does not have sufficient permissions - access denied"
|
|
51
|
+
HAS_PERMISSION=false
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
if [[ "$HAS_PERMISSION" == "true" ]]; then
|
|
56
|
+
# Get PR details
|
|
57
|
+
PR_NUMBER="${{ github.event.issue.number }}"
|
|
58
|
+
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER)
|
|
59
|
+
PR_STATE=$(echo "$PR_DATA" | jq -r .state)
|
|
60
|
+
PR_HEAD_REF=$(echo "$PR_DATA" | jq -r .head.ref)
|
|
61
|
+
PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r .head.sha)
|
|
62
|
+
|
|
63
|
+
if [[ "$PR_STATE" == "open" ]]; then
|
|
64
|
+
echo "should-release=true" >> $GITHUB_OUTPUT
|
|
65
|
+
echo "pr-number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
|
66
|
+
echo "pr-head-ref=$PR_HEAD_REF" >> $GITHUB_OUTPUT
|
|
67
|
+
echo "pr-head-sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT
|
|
68
|
+
echo "PR #$PR_NUMBER is open and ready for beta release"
|
|
69
|
+
else
|
|
70
|
+
echo "should-release=false" >> $GITHUB_OUTPUT
|
|
71
|
+
echo "PR #$PR_NUMBER is not open"
|
|
72
|
+
fi
|
|
73
|
+
else
|
|
74
|
+
echo "should-release=false" >> $GITHUB_OUTPUT
|
|
75
|
+
echo "User $COMMENT_USER does not have permission to trigger beta releases"
|
|
76
|
+
|
|
77
|
+
# Comment on PR about insufficient permissions
|
|
78
|
+
gh pr comment ${{ github.event.issue.number }} --body "❌ **Permission Denied**
|
|
79
|
+
|
|
80
|
+
@$COMMENT_USER, you don't have sufficient permissions to trigger beta releases. Only the repository owner or users with write access can trigger beta releases by commenting \`/beta-release\`."
|
|
81
|
+
fi
|
|
82
|
+
else
|
|
83
|
+
echo "should-release=false" >> $GITHUB_OUTPUT
|
|
84
|
+
echo "Comment does not contain beta release trigger"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
pr-beta-release:
|
|
88
|
+
needs: check-conditions
|
|
89
|
+
if: needs.check-conditions.outputs.should-release == 'true'
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
permissions:
|
|
92
|
+
contents: write
|
|
93
|
+
packages: write
|
|
94
|
+
pull-requests: write
|
|
95
|
+
steps:
|
|
96
|
+
- name: Checkout PR source branch
|
|
97
|
+
uses: actions/checkout@v4
|
|
98
|
+
with:
|
|
99
|
+
ref: ${{ needs.check-conditions.outputs.pr-head-sha }}
|
|
100
|
+
fetch-depth: 0
|
|
101
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
102
|
+
|
|
103
|
+
- name: Load beta release configuration
|
|
104
|
+
id: config
|
|
105
|
+
run: |
|
|
106
|
+
if [ -f ".beta-release.json" ]; then
|
|
107
|
+
echo "Configuration file found"
|
|
108
|
+
ENABLED=$(jq -r '.betaRelease.enabled // true' .beta-release.json)
|
|
109
|
+
PR_BETA_ENABLED=$(jq -r '.betaRelease.prBetaRelease.enabled // false' .beta-release.json)
|
|
110
|
+
VERSION_STRATEGY=$(jq -r '.betaRelease.prBetaRelease.versionStrategy // "patch"' .beta-release.json)
|
|
111
|
+
PUBLISH_TAG=$(jq -r '.betaRelease.prBetaRelease.publishTag // "pr-beta"' .beta-release.json)
|
|
112
|
+
CREATE_GITHUB_RELEASE=$(jq -r '.betaRelease.prBetaRelease.createGitHubRelease // false' .beta-release.json)
|
|
113
|
+
|
|
114
|
+
echo "enabled=$ENABLED" >> $GITHUB_OUTPUT
|
|
115
|
+
echo "pr-beta-enabled=$PR_BETA_ENABLED" >> $GITHUB_OUTPUT
|
|
116
|
+
echo "version-strategy=$VERSION_STRATEGY" >> $GITHUB_OUTPUT
|
|
117
|
+
echo "publish-tag=$PUBLISH_TAG" >> $GITHUB_OUTPUT
|
|
118
|
+
echo "create-github-release=$CREATE_GITHUB_RELEASE" >> $GITHUB_OUTPUT
|
|
119
|
+
|
|
120
|
+
echo "Beta release enabled: $ENABLED"
|
|
121
|
+
echo "PR Beta release enabled: $PR_BETA_ENABLED"
|
|
122
|
+
else
|
|
123
|
+
echo "No configuration file found, using defaults"
|
|
124
|
+
echo "enabled=true" >> $GITHUB_OUTPUT
|
|
125
|
+
echo "pr-beta-enabled=false" >> $GITHUB_OUTPUT
|
|
126
|
+
echo "version-strategy=patch" >> $GITHUB_OUTPUT
|
|
127
|
+
echo "publish-tag=pr-beta" >> $GITHUB_OUTPUT
|
|
128
|
+
echo "create-github-release=false" >> $GITHUB_OUTPUT
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
- name: Check if PR beta release should proceed
|
|
132
|
+
if: steps.config.outputs.enabled != 'true' || steps.config.outputs.pr-beta-enabled != 'true'
|
|
133
|
+
run: |
|
|
134
|
+
echo "PR beta release is disabled"
|
|
135
|
+
echo "General beta enabled: ${{ steps.config.outputs.enabled }}"
|
|
136
|
+
echo "PR beta enabled: ${{ steps.config.outputs.pr-beta-enabled }}"
|
|
137
|
+
|
|
138
|
+
# Comment on PR about disabled feature
|
|
139
|
+
gh pr comment ${{ needs.check-conditions.outputs.pr-number }} --body "❌ **PR Beta Release Disabled**
|
|
140
|
+
|
|
141
|
+
PR beta releases are currently disabled in the configuration. To enable:
|
|
142
|
+
|
|
143
|
+
1. Update \`.beta-release.json\`:
|
|
144
|
+
\`\`\`json
|
|
145
|
+
{
|
|
146
|
+
\"betaRelease\": {
|
|
147
|
+
\"enabled\": true,
|
|
148
|
+
\"prBetaRelease\": {
|
|
149
|
+
\"enabled\": true
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
2. Commit and push the configuration change
|
|
156
|
+
3. Comment \`/beta-release\` again to trigger the release"
|
|
157
|
+
|
|
158
|
+
exit 1
|
|
159
|
+
env:
|
|
160
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
161
|
+
|
|
162
|
+
- name: Setup Node.js
|
|
163
|
+
uses: actions/setup-node@v4
|
|
164
|
+
with:
|
|
165
|
+
node-version: '>=18'
|
|
166
|
+
registry-url: 'https://registry.npmjs.org'
|
|
167
|
+
scope: '@alex_neo'
|
|
168
|
+
|
|
169
|
+
- name: Configure Git
|
|
170
|
+
run: |
|
|
171
|
+
git config user.name "github-actions[bot]"
|
|
172
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
173
|
+
|
|
174
|
+
- name: Install dependencies
|
|
175
|
+
run: yarn --ignore-engines
|
|
176
|
+
|
|
177
|
+
- name: Build project
|
|
178
|
+
run: yarn build
|
|
179
|
+
|
|
180
|
+
- name: Generate PR beta version
|
|
181
|
+
id: version
|
|
182
|
+
run: |
|
|
183
|
+
# Get current version from source branch
|
|
184
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
185
|
+
echo "Current version: $CURRENT_VERSION"
|
|
186
|
+
|
|
187
|
+
VERSION_STRATEGY="${{ steps.config.outputs.version-strategy }}"
|
|
188
|
+
PR_NUMBER="${{ needs.check-conditions.outputs.pr-number }}"
|
|
189
|
+
PR_HEAD_REF="${{ needs.check-conditions.outputs.pr-head-ref }}"
|
|
190
|
+
|
|
191
|
+
echo "Version strategy: $VERSION_STRATEGY"
|
|
192
|
+
echo "PR number: $PR_NUMBER"
|
|
193
|
+
echo "PR branch: $PR_HEAD_REF"
|
|
194
|
+
|
|
195
|
+
# Remove any existing prerelease suffixes and create PR-specific beta
|
|
196
|
+
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-.*$//')
|
|
197
|
+
|
|
198
|
+
# Increment version based on strategy
|
|
199
|
+
IFS='.' read -ra VERSION_PARTS <<< "$BASE_VERSION"
|
|
200
|
+
MAJOR=${VERSION_PARTS[0]}
|
|
201
|
+
MINOR=${VERSION_PARTS[1]}
|
|
202
|
+
PATCH=${VERSION_PARTS[2]}
|
|
203
|
+
|
|
204
|
+
case $VERSION_STRATEGY in
|
|
205
|
+
"major")
|
|
206
|
+
NEW_MAJOR=$((MAJOR + 1))
|
|
207
|
+
NEW_BASE_VERSION="$NEW_MAJOR.0.0"
|
|
208
|
+
;;
|
|
209
|
+
"minor")
|
|
210
|
+
NEW_MINOR=$((MINOR + 1))
|
|
211
|
+
NEW_BASE_VERSION="$MAJOR.$NEW_MINOR.0"
|
|
212
|
+
;;
|
|
213
|
+
*)
|
|
214
|
+
NEW_PATCH=$((PATCH + 1))
|
|
215
|
+
NEW_BASE_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
|
216
|
+
;;
|
|
217
|
+
esac
|
|
218
|
+
|
|
219
|
+
# Create PR-specific beta version with branch name and commit sha
|
|
220
|
+
SAFE_BRANCH_NAME=$(echo "$PR_HEAD_REF" | sed 's/[^a-zA-Z0-9.-]/-/g' | sed 's/--*/-/g')
|
|
221
|
+
SHORT_SHA=$(echo "${{ needs.check-conditions.outputs.pr-head-sha }}" | cut -c1-7)
|
|
222
|
+
NEW_VERSION="$NEW_BASE_VERSION-pr$PR_NUMBER.$SAFE_BRANCH_NAME.$SHORT_SHA"
|
|
223
|
+
|
|
224
|
+
echo "New version: $NEW_VERSION"
|
|
225
|
+
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
226
|
+
echo "base-version=$NEW_BASE_VERSION" >> $GITHUB_OUTPUT
|
|
227
|
+
|
|
228
|
+
# Update package.json version
|
|
229
|
+
npm version "$NEW_VERSION" --no-git-tag-version
|
|
230
|
+
|
|
231
|
+
- name: Build for publishing
|
|
232
|
+
run: yarn build
|
|
233
|
+
|
|
234
|
+
- name: Publish to npm
|
|
235
|
+
run: yarn publish --access public --tag ${{ steps.config.outputs.publish-tag }}
|
|
236
|
+
env:
|
|
237
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
238
|
+
|
|
239
|
+
- name: Create GitHub Release
|
|
240
|
+
if: steps.config.outputs.create-github-release == 'true'
|
|
241
|
+
run: |
|
|
242
|
+
gh release create "v${{ steps.version.outputs.new-version }}" \
|
|
243
|
+
--title "PR Beta Release v${{ steps.version.outputs.new-version }}" \
|
|
244
|
+
--notes "🧪 **PR Beta Release v${{ steps.version.outputs.new-version }}**
|
|
245
|
+
|
|
246
|
+
This is a beta release for testing changes in PR #${{ needs.check-conditions.outputs.pr-number }}.
|
|
247
|
+
|
|
248
|
+
**Source Branch:** \`${{ needs.check-conditions.outputs.pr-head-ref }}\`
|
|
249
|
+
**Base Version:** \`${{ steps.version.outputs.base-version }}\`
|
|
250
|
+
|
|
251
|
+
**Installation:**
|
|
252
|
+
\`\`\`bash
|
|
253
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.config.outputs.publish-tag }}
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
**Specific Version:**
|
|
257
|
+
\`\`\`bash
|
|
258
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.version.outputs.new-version }}
|
|
259
|
+
\`\`\`
|
|
260
|
+
|
|
261
|
+
**⚠️ Warning:** This is a beta release for testing purposes only. Do not use in production." \
|
|
262
|
+
--prerelease
|
|
263
|
+
env:
|
|
264
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
265
|
+
|
|
266
|
+
- name: Comment on PR with release info
|
|
267
|
+
run: |
|
|
268
|
+
gh pr comment ${{ needs.check-conditions.outputs.pr-number }} --body "🎉 **Beta Release Published!**
|
|
269
|
+
|
|
270
|
+
**Version:** \`v${{ steps.version.outputs.new-version }}\`
|
|
271
|
+
**npm Tag:** \`${{ steps.config.outputs.publish-tag }}\`
|
|
272
|
+
|
|
273
|
+
## 📦 Installation
|
|
274
|
+
|
|
275
|
+
**Install latest from this PR:**
|
|
276
|
+
\`\`\`bash
|
|
277
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.config.outputs.publish-tag }}
|
|
278
|
+
\`\`\`
|
|
279
|
+
|
|
280
|
+
**Install specific version:**
|
|
281
|
+
\`\`\`bash
|
|
282
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.version.outputs.new-version }}
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
## 🧪 Testing
|
|
286
|
+
|
|
287
|
+
This beta release contains the changes from this PR and can be used to test the functionality before merging.
|
|
288
|
+
|
|
289
|
+
**Branch:** \`${{ needs.check-conditions.outputs.pr-head-ref }}\`
|
|
290
|
+
**Commit:** \`${{ needs.check-conditions.outputs.pr-head-sha }}\`
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
*To trigger another beta release after pushing new changes, comment \`/beta-release\` again.*"
|
|
294
|
+
env:
|
|
295
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
296
|
+
|
|
297
|
+
pr-opened-info:
|
|
298
|
+
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize')
|
|
299
|
+
runs-on: ubuntu-latest
|
|
300
|
+
permissions:
|
|
301
|
+
pull-requests: write
|
|
302
|
+
steps:
|
|
303
|
+
- name: Checkout
|
|
304
|
+
uses: actions/checkout@v4
|
|
305
|
+
|
|
306
|
+
- name: Check if PR beta release is available
|
|
307
|
+
id: check-config
|
|
308
|
+
run: |
|
|
309
|
+
if [ -f ".beta-release.json" ]; then
|
|
310
|
+
ENABLED=$(jq -r '.betaRelease.enabled // true' .beta-release.json)
|
|
311
|
+
PR_BETA_ENABLED=$(jq -r '.betaRelease.prBetaRelease.enabled // false' .beta-release.json)
|
|
312
|
+
echo "enabled=$ENABLED" >> $GITHUB_OUTPUT
|
|
313
|
+
echo "pr-beta-enabled=$PR_BETA_ENABLED" >> $GITHUB_OUTPUT
|
|
314
|
+
else
|
|
315
|
+
echo "enabled=true" >> $GITHUB_OUTPUT
|
|
316
|
+
echo "pr-beta-enabled=false" >> $GITHUB_OUTPUT
|
|
317
|
+
fi
|
|
318
|
+
|
|
319
|
+
- name: Comment on PR about beta release availability
|
|
320
|
+
if: steps.check-config.outputs.enabled == 'true' && steps.check-config.outputs.pr-beta-enabled == 'true' && github.event.action == 'opened'
|
|
321
|
+
run: |
|
|
322
|
+
gh pr comment ${{ github.event.pull_request.number }} --body "🚀 **Beta Release Available**
|
|
323
|
+
|
|
324
|
+
This repository supports beta releases for pull requests! You can create a beta version to test your changes before merging.
|
|
325
|
+
|
|
326
|
+
## 📦 How to Create a Beta Release
|
|
327
|
+
|
|
328
|
+
Comment \`/beta-release\` on this PR to trigger an automatic beta release that includes all changes from this branch.
|
|
329
|
+
|
|
330
|
+
The beta release will:
|
|
331
|
+
- 📦 Publish to npm with a unique version based on your branch
|
|
332
|
+
- 🏷️ Use the \`pr-beta\` tag for easy installation
|
|
333
|
+
- 💬 Post installation instructions back to this PR
|
|
334
|
+
|
|
335
|
+
## 🧪 Testing Your Changes
|
|
336
|
+
|
|
337
|
+
Once published, you and others can install and test your changes with:
|
|
338
|
+
\`\`\`bash
|
|
339
|
+
npm install @alex_neo/playwright-azure-reporter@pr-beta
|
|
340
|
+
\`\`\`
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
*This message appears because PR beta releases are enabled in the repository configuration.*"
|
|
344
|
+
env:
|
|
345
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -3,28 +3,155 @@ name: Publish
|
|
|
3
3
|
on:
|
|
4
4
|
release:
|
|
5
5
|
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
version_strategy:
|
|
9
|
+
description: 'Version increment strategy (patch, minor, major)'
|
|
10
|
+
required: false
|
|
11
|
+
default: 'patch'
|
|
12
|
+
type: choice
|
|
13
|
+
options:
|
|
14
|
+
- patch
|
|
15
|
+
- minor
|
|
16
|
+
- major
|
|
6
17
|
|
|
7
18
|
jobs:
|
|
8
19
|
publish:
|
|
9
20
|
runs-on: ubuntu-latest
|
|
10
21
|
permissions:
|
|
11
|
-
contents:
|
|
22
|
+
contents: write
|
|
12
23
|
packages: write
|
|
13
24
|
steps:
|
|
14
25
|
- name: Checkout
|
|
15
26
|
uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
30
|
+
|
|
31
|
+
- name: Load release configuration
|
|
32
|
+
id: config
|
|
33
|
+
run: |
|
|
34
|
+
if [ -f ".beta-release.json" ]; then
|
|
35
|
+
echo "Configuration file found"
|
|
36
|
+
# Use stable release configuration if available, otherwise use defaults
|
|
37
|
+
ENABLED=$(jq -r '.stableRelease.enabled // true' .beta-release.json)
|
|
38
|
+
VERSION_STRATEGY=$(jq -r '.stableRelease.versionStrategy // "patch"' .beta-release.json)
|
|
39
|
+
PUBLISH_TAG=$(jq -r '.stableRelease.publishTag // "latest"' .beta-release.json)
|
|
40
|
+
CREATE_GITHUB_RELEASE=$(jq -r '.stableRelease.createGitHubRelease // true' .beta-release.json)
|
|
41
|
+
|
|
42
|
+
echo "enabled=$ENABLED" >> $GITHUB_OUTPUT
|
|
43
|
+
echo "version-strategy=$VERSION_STRATEGY" >> $GITHUB_OUTPUT
|
|
44
|
+
echo "publish-tag=$PUBLISH_TAG" >> $GITHUB_OUTPUT
|
|
45
|
+
echo "create-github-release=$CREATE_GITHUB_RELEASE" >> $GITHUB_OUTPUT
|
|
46
|
+
|
|
47
|
+
echo "Stable release enabled: $ENABLED"
|
|
48
|
+
echo "Version strategy: $VERSION_STRATEGY"
|
|
49
|
+
echo "Publish tag: $PUBLISH_TAG"
|
|
50
|
+
else
|
|
51
|
+
echo "No configuration file found, using defaults"
|
|
52
|
+
echo "enabled=true" >> $GITHUB_OUTPUT
|
|
53
|
+
echo "version-strategy=patch" >> $GITHUB_OUTPUT
|
|
54
|
+
echo "publish-tag=latest" >> $GITHUB_OUTPUT
|
|
55
|
+
echo "create-github-release=true" >> $GITHUB_OUTPUT
|
|
56
|
+
fi
|
|
57
|
+
|
|
16
58
|
- name: Setup Node.js
|
|
17
59
|
uses: actions/setup-node@v4
|
|
18
60
|
with:
|
|
19
61
|
node-version: '>=18'
|
|
20
62
|
registry-url: 'https://registry.npmjs.org'
|
|
21
|
-
# Defaults to the user or organization that owns the workflow file
|
|
22
63
|
scope: '@alex_neo'
|
|
64
|
+
|
|
65
|
+
- name: Configure Git
|
|
66
|
+
run: |
|
|
67
|
+
git config user.name "github-actions[bot]"
|
|
68
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
69
|
+
|
|
23
70
|
- name: Install dependencies
|
|
24
71
|
run: yarn --ignore-engines
|
|
25
|
-
|
|
72
|
+
|
|
73
|
+
- name: Build project
|
|
26
74
|
run: yarn build
|
|
27
|
-
|
|
28
|
-
|
|
75
|
+
|
|
76
|
+
- name: Generate release version
|
|
77
|
+
id: version
|
|
78
|
+
if: github.event_name == 'workflow_dispatch'
|
|
79
|
+
run: |
|
|
80
|
+
# Get current version
|
|
81
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
82
|
+
echo "Current version: $CURRENT_VERSION"
|
|
83
|
+
|
|
84
|
+
VERSION_STRATEGY="${{ github.event.inputs.version_strategy || steps.config.outputs.version-strategy }}"
|
|
85
|
+
echo "Version strategy: $VERSION_STRATEGY"
|
|
86
|
+
|
|
87
|
+
# Parse version and increment based on strategy
|
|
88
|
+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
|
89
|
+
MAJOR=${VERSION_PARTS[0]}
|
|
90
|
+
MINOR=${VERSION_PARTS[1]}
|
|
91
|
+
PATCH=${VERSION_PARTS[2]%%-*} # Remove any pre-release suffix
|
|
92
|
+
|
|
93
|
+
case $VERSION_STRATEGY in
|
|
94
|
+
"major")
|
|
95
|
+
NEW_MAJOR=$((MAJOR + 1))
|
|
96
|
+
NEW_VERSION="$NEW_MAJOR.0.0"
|
|
97
|
+
;;
|
|
98
|
+
"minor")
|
|
99
|
+
NEW_MINOR=$((MINOR + 1))
|
|
100
|
+
NEW_VERSION="$MAJOR.$NEW_MINOR.0"
|
|
101
|
+
;;
|
|
102
|
+
*)
|
|
103
|
+
NEW_PATCH=$((PATCH + 1))
|
|
104
|
+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
|
105
|
+
;;
|
|
106
|
+
esac
|
|
107
|
+
|
|
108
|
+
echo "New version: $NEW_VERSION"
|
|
109
|
+
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
110
|
+
|
|
111
|
+
# Update package.json version
|
|
112
|
+
npm version "$NEW_VERSION" --no-git-tag-version
|
|
113
|
+
|
|
114
|
+
- name: Update changelog
|
|
115
|
+
if: github.event_name == 'workflow_dispatch'
|
|
116
|
+
run: |
|
|
117
|
+
# Generate changelog for the new release version
|
|
118
|
+
npx conventional-changelog -p angular -i CHANGELOG.md -s
|
|
119
|
+
|
|
120
|
+
- name: Commit version changes
|
|
121
|
+
if: github.event_name == 'workflow_dispatch' && steps.version.outputs.new-version
|
|
122
|
+
run: |
|
|
123
|
+
git add package.json CHANGELOG.md
|
|
124
|
+
git commit -m "chore: release v${{ steps.version.outputs.new-version }}"
|
|
125
|
+
git tag "v${{ steps.version.outputs.new-version }}"
|
|
126
|
+
|
|
127
|
+
- name: Push changes
|
|
128
|
+
if: github.event_name == 'workflow_dispatch' && steps.version.outputs.new-version
|
|
129
|
+
run: |
|
|
130
|
+
git push origin main
|
|
131
|
+
git push origin "v${{ steps.version.outputs.new-version }}"
|
|
132
|
+
|
|
133
|
+
- name: Build for publishing
|
|
134
|
+
run: yarn build
|
|
135
|
+
|
|
136
|
+
- name: Publish to npm
|
|
137
|
+
run: yarn publish --access public --tag ${{ steps.config.outputs.publish-tag }}
|
|
29
138
|
env:
|
|
30
139
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
140
|
+
|
|
141
|
+
- name: Create GitHub Release
|
|
142
|
+
if: steps.config.outputs.create-github-release == 'true' && (github.event_name == 'release' || steps.version.outputs.new-version)
|
|
143
|
+
run: |
|
|
144
|
+
RELEASE_VERSION="${{ steps.version.outputs.new-version || github.event.release.tag_name }}"
|
|
145
|
+
gh release create "$RELEASE_VERSION" \
|
|
146
|
+
--title "Release $RELEASE_VERSION" \
|
|
147
|
+
--notes "🎉 **Release $RELEASE_VERSION**
|
|
148
|
+
|
|
149
|
+
This is a stable release.
|
|
150
|
+
|
|
151
|
+
**Installation:**
|
|
152
|
+
\`\`\`bash
|
|
153
|
+
npm install @alex_neo/playwright-azure-reporter@${{ steps.config.outputs.publish-tag }}
|
|
154
|
+
\`\`\`" \
|
|
155
|
+
--latest
|
|
156
|
+
env:
|
|
157
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
## [1.13.2-beta.0](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.13.1...v1.13.2-beta.0) (2025-08-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add missing conventional-changelog dependencies for beta release ([caa4a7b](https://github.com/alexneo2003/playwright-azure-reporter/commit/caa4a7bce86f31684bef69c8610f7b52ab8a272f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add automatic beta releases for PR merges ([39191e8](https://github.com/alexneo2003/playwright-azure-reporter/commit/39191e8ac0ea20e1f133e2c173146993b93e4dd2))
|
|
12
|
+
* add PR beta release functionality with manual confirmation ([4c61d21](https://github.com/alexneo2003/playwright-azure-reporter/commit/4c61d21db88a4954cce5131fd0349818925435df))
|
|
13
|
+
* add repository owner permission check for PR beta releases ([1242bb3](https://github.com/alexneo2003/playwright-azure-reporter/commit/1242bb322783f40e80f89bd75f58c1ede2ee6def))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.13.2-beta.0](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.13.1...v1.13.2-beta.0) (2025-08-31)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add missing conventional-changelog dependencies for beta release ([caa4a7b](https://github.com/alexneo2003/playwright-azure-reporter/commit/caa4a7bce86f31684bef69c8610f7b52ab8a272f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* add automatic beta releases for PR merges ([39191e8](https://github.com/alexneo2003/playwright-azure-reporter/commit/39191e8ac0ea20e1f133e2c173146993b93e4dd2))
|
|
28
|
+
* add PR beta release functionality with manual confirmation ([4c61d21](https://github.com/alexneo2003/playwright-azure-reporter/commit/4c61d21db88a4954cce5131fd0349818925435df))
|
|
29
|
+
* add repository owner permission check for PR beta releases ([1242bb3](https://github.com/alexneo2003/playwright-azure-reporter/commit/1242bb322783f40e80f89bd75f58c1ede2ee6def))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [1.13.2](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.13.1...v1.13.2) (2025-08-31)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* add missing conventional-changelog dependencies for beta release ([caa4a7b](https://github.com/alexneo2003/playwright-azure-reporter/commit/caa4a7bce86f31684bef69c8610f7b52ab8a272f))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
1
42
|
## [1.13.1](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.13.0...v1.13.1) (2025-04-11)
|
|
2
43
|
|
|
3
44
|
|
package/README.md
CHANGED
package/RELEASES.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Releases
|
|
2
|
+
|
|
3
|
+
This project supports both stable releases and beta releases with sophisticated versioning workflows.
|
|
4
|
+
|
|
5
|
+
## Stable Releases
|
|
6
|
+
|
|
7
|
+
The stable release workflow provides enhanced version management capabilities:
|
|
8
|
+
|
|
9
|
+
- **Automatic Publishing**: Triggered when a GitHub release is published
|
|
10
|
+
- **Manual Versioning**: Can be triggered manually via workflow dispatch with version strategy selection
|
|
11
|
+
- **Version Management**: Supports patch, minor, and major version increments
|
|
12
|
+
- **Changelog Generation**: Automatically updates CHANGELOG.md using conventional commits
|
|
13
|
+
- **Git Operations**: Creates version tags and commits changes
|
|
14
|
+
- **Configuration**: Customizable via `.beta-release.json` configuration file
|
|
15
|
+
|
|
16
|
+
### Manual Stable Release
|
|
17
|
+
|
|
18
|
+
You can trigger a stable release manually using the GitHub Actions workflow:
|
|
19
|
+
|
|
20
|
+
1. Go to the Actions tab in the repository
|
|
21
|
+
2. Select "Publish" workflow
|
|
22
|
+
3. Click "Run workflow"
|
|
23
|
+
4. Select version increment strategy (patch, minor, major)
|
|
24
|
+
|
|
25
|
+
The workflow will:
|
|
26
|
+
- Generate the new version based on the selected strategy
|
|
27
|
+
- Update package.json and CHANGELOG.md
|
|
28
|
+
- Create a git tag and commit
|
|
29
|
+
- Build and publish to npm with the `latest` tag
|
|
30
|
+
- Create a GitHub release
|
|
31
|
+
|
|
32
|
+
## Beta Releases
|
|
33
|
+
|
|
34
|
+
This project supports two types of beta releases to help test new features and bug fixes before they are included in stable releases:
|
|
35
|
+
|
|
36
|
+
1. **Merge Beta Releases**: Automatically triggered when pull requests are merged
|
|
37
|
+
2. **PR Beta Releases**: Manually triggered for individual pull requests
|
|
38
|
+
|
|
39
|
+
### Merge Beta Releases
|
|
40
|
+
|
|
41
|
+
- **Automatic Triggering**: Beta releases are automatically triggered when pull requests are merged into the main branch (or other configured branches)
|
|
42
|
+
- **Version Strategy**: Beta versions follow semantic versioning with a `-beta.X` suffix (e.g., `1.13.2-beta.0`)
|
|
43
|
+
- **Installation**: Install beta releases using the beta tag: `npm install @alex_neo/playwright-azure-reporter@beta`
|
|
44
|
+
|
|
45
|
+
### PR Beta Releases
|
|
46
|
+
|
|
47
|
+
PR beta releases allow you to test changes from a specific pull request before it's merged:
|
|
48
|
+
|
|
49
|
+
- **Manual Triggering**: Comment `/beta-release` on any open pull request to create a beta version
|
|
50
|
+
- **Source Branch**: The beta is built from the PR's source branch, not the target branch
|
|
51
|
+
- **Unique Versioning**: Each PR beta gets a unique version like `1.13.3-pr42.feature-branch.a1b2c3d`
|
|
52
|
+
- **Installation**: Install with the pr-beta tag: `npm install @alex_neo/playwright-azure-reporter@pr-beta`
|
|
53
|
+
|
|
54
|
+
### Configuration
|
|
55
|
+
|
|
56
|
+
You can customize release behavior by creating a `.beta-release.json` file in your project root:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"betaRelease": {
|
|
61
|
+
"enabled": true,
|
|
62
|
+
"branches": ["main", "develop"],
|
|
63
|
+
"versionStrategy": "patch",
|
|
64
|
+
"publishTag": "beta",
|
|
65
|
+
"createGitHubRelease": true,
|
|
66
|
+
"prBetaRelease": {
|
|
67
|
+
"enabled": true,
|
|
68
|
+
"versionStrategy": "patch",
|
|
69
|
+
"publishTag": "pr-beta",
|
|
70
|
+
"createGitHubRelease": false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"stableRelease": {
|
|
74
|
+
"enabled": true,
|
|
75
|
+
"versionStrategy": "patch",
|
|
76
|
+
"publishTag": "latest",
|
|
77
|
+
"createGitHubRelease": true
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Configuration Options:**
|
|
83
|
+
|
|
84
|
+
**Merge Beta Releases:**
|
|
85
|
+
- `enabled` (boolean): Enable or disable automatic beta releases. Default: `true`
|
|
86
|
+
- `branches` (string[]): List of branches that trigger beta releases when PRs are merged. Default: `["main"]`
|
|
87
|
+
- `versionStrategy` (string): Version increment strategy - `"patch"`, `"minor"`, or `"major"`. Default: `"patch"`
|
|
88
|
+
- `publishTag` (string): npm dist-tag for publishing beta releases. Default: `"beta"`
|
|
89
|
+
- `createGitHubRelease` (boolean): Whether to create GitHub releases for beta versions. Default: `true`
|
|
90
|
+
|
|
91
|
+
**PR Beta Releases:**
|
|
92
|
+
- `prBetaRelease.enabled` (boolean): Enable or disable PR beta releases. Default: `false`
|
|
93
|
+
- `prBetaRelease.versionStrategy` (string): Version increment strategy for PR betas. Default: `"patch"`
|
|
94
|
+
- `prBetaRelease.publishTag` (string): npm dist-tag for PR beta releases. Default: `"pr-beta"`
|
|
95
|
+
- `prBetaRelease.createGitHubRelease` (boolean): Whether to create GitHub releases for PR betas. Default: `false`
|
|
96
|
+
|
|
97
|
+
**Stable Releases:**
|
|
98
|
+
- `stableRelease.enabled` (boolean): Enable or disable enhanced stable release workflow. Default: `true`
|
|
99
|
+
- `stableRelease.versionStrategy` (string): Version increment strategy for stable releases. Default: `"patch"`
|
|
100
|
+
- `stableRelease.publishTag` (string): npm dist-tag for publishing stable releases. Default: `"latest"`
|
|
101
|
+
- `stableRelease.createGitHubRelease` (boolean): Whether to create GitHub releases for stable versions. Default: `true`
|
|
102
|
+
|
|
103
|
+
### Installing Beta Releases
|
|
104
|
+
|
|
105
|
+
**Install the latest merge beta release:**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install @alex_neo/playwright-azure-reporter@beta
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Install the latest PR beta release:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install @alex_neo/playwright-azure-reporter@pr-beta
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Install a specific beta version:**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm install @alex_neo/playwright-azure-reporter@1.13.2-beta.0
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Install a specific PR beta version:**
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install @alex_neo/playwright-azure-reporter@1.13.3-pr42.feature-branch.a1b2c3d
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Manual Beta Release
|
|
130
|
+
|
|
131
|
+
**Merge Beta Releases:**
|
|
132
|
+
|
|
133
|
+
You can trigger merge beta releases manually using the GitHub Actions workflow:
|
|
134
|
+
|
|
135
|
+
1. Go to the Actions tab in the repository
|
|
136
|
+
2. Select "Beta Release" workflow
|
|
137
|
+
3. Click "Run workflow"
|
|
138
|
+
4. Optionally specify a different branch
|
|
139
|
+
|
|
140
|
+
**PR Beta Releases:**
|
|
141
|
+
|
|
142
|
+
To create a beta release for a specific pull request:
|
|
143
|
+
|
|
144
|
+
1. **Open the pull request** you want to test
|
|
145
|
+
2. **Comment `/beta-release`** on the PR
|
|
146
|
+
3. **Wait for the workflow** to build and publish the beta version
|
|
147
|
+
4. **Follow the installation instructions** posted back to the PR
|
|
148
|
+
|
|
149
|
+
The PR beta release will include all changes from the PR's source branch and create a unique version identifier.
|
|
150
|
+
|
|
151
|
+
**Note:** Beta releases are for testing purposes and may contain experimental features. For production use, always use the latest stable release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alex_neo/playwright-azure-reporter",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2-beta.0",
|
|
4
4
|
"description": "Playwright Azure Reporter",
|
|
5
5
|
"main": "./dist/playwright-azure-reporter.js",
|
|
6
6
|
"types": "./dist/playwright-azure-reporter.d.js",
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
68
68
|
"@typescript-eslint/eslint-plugin-tslint": "^5.57.1",
|
|
69
69
|
"@typescript-eslint/parser": "^5.57.1",
|
|
70
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
71
|
+
"conventional-github-releaser": "^3.1.5",
|
|
70
72
|
"eslint": "^8.37.0",
|
|
71
73
|
"eslint-config-standard": "^17.0.0",
|
|
72
74
|
"eslint-plugin-import": "^2.27.5",
|