-
Notifications
You must be signed in to change notification settings - Fork 50.8k
ci: Add v2 branching strategy infrastructure #22217
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
Open
seemewalkin
wants to merge
8
commits into
master
Choose a base branch
from
test/v2-branching-strategy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb4f4b8
feat(ci): Add v2 branching strategy infrastructure
seemewalkin d1d86c6
ci: Fix cubic's comments
seemewalkin 44c2469
ci: Add '1' to releaseChannel type in api-types
seemewalkin e48c80d
ci: Address prop type
seemewalkin 277c506
Merge branch 'master' into test/v2-branching-strategy
seemewalkin e6c812c
ci: Added '1' and 'beta' to security-scan-runners condition
seemewalkin 16d7103
ci: Add npm install before the validation step
seemewalkin 25f1d41
ci: Fixes
seemewalkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { appendFileSync } from 'node:fs'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import semver from 'semver'; | ||
|
|
||
| class VersionClassifier { | ||
| constructor() { | ||
| this.githubOutput = process.env.GITHUB_OUTPUT || null; | ||
| } | ||
|
|
||
| classify(versionString) { | ||
| // Reject versions with 'v' prefix | ||
| if (versionString.startsWith('v')) { | ||
| throw new Error(`Invalid version format: ${versionString}`); | ||
| } | ||
|
|
||
| // Parse version with semver | ||
| const parsed = semver.parse(versionString); | ||
|
|
||
| if (!parsed) { | ||
| throw new Error(`Invalid version format: ${versionString}`); | ||
| } | ||
|
|
||
| // Extract components | ||
| const major = parsed.major; | ||
| const minor = parsed.minor; | ||
| const patch = parsed.patch; | ||
| const prerelease = parsed.prerelease.length > 0 ? parsed.prerelease.join('.') : ''; | ||
| const isPrerelease = parsed.prerelease.length > 0; | ||
|
|
||
| // Identify prerelease types | ||
| const isRc = parsed.prerelease.length > 0 && parsed.prerelease[0] === 'rc'; | ||
| const isBeta = parsed.prerelease.length > 0 && parsed.prerelease[0] === 'beta'; | ||
| const isDev = parsed.prerelease.length > 0 && parsed.prerelease[0] === 'dev'; | ||
| const isExp = parsed.prerelease.length > 0 && parsed.prerelease[0] === 'exp'; | ||
|
|
||
| return { | ||
| major, | ||
| minor, | ||
| patch, | ||
| prerelease, | ||
| is_prerelease: isPrerelease, | ||
| is_rc: isRc, | ||
| is_beta: isBeta, | ||
| is_dev: isDev, | ||
| is_exp: isExp, | ||
| }; | ||
| } | ||
|
|
||
| output(data) { | ||
| if (this.githubOutput) { | ||
| // Write to GITHUB_OUTPUT for GitHub Actions | ||
| const outputs = [ | ||
| `major=${data.major}`, | ||
| `minor=${data.minor}`, | ||
| `patch=${data.patch}`, | ||
| `prerelease=${data.prerelease}`, | ||
| `is_prerelease=${data.is_prerelease}`, | ||
| `is_rc=${data.is_rc}`, | ||
| `is_beta=${data.is_beta}`, | ||
| `is_dev=${data.is_dev}`, | ||
| `is_exp=${data.is_exp}`, | ||
| ]; | ||
| appendFileSync(this.githubOutput, outputs.join('\n') + '\n'); | ||
|
|
||
| // Debug output for CI logs | ||
| console.log(`Parsed version: major=${data.major}, minor=${data.minor}, patch=${data.patch}, prerelease=${data.prerelease}`); | ||
| } else { | ||
| // Output JSON to stdout for local testing | ||
| console.log(JSON.stringify(data, null, 2)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // CLI - Simple argument parsing | ||
| if (fileURLToPath(import.meta.url) === process.argv[1]) { | ||
| const args = process.argv.slice(2); | ||
| const getArg = (name) => { | ||
| const index = args.indexOf(`--${name}`); | ||
| if (index === -1 || !args[index + 1]) return undefined; | ||
| const value = args[index + 1]; | ||
| // Handle empty strings and 'null' as undefined | ||
| return value === '' || value === 'null' ? undefined : value; | ||
| }; | ||
|
|
||
| try { | ||
| const versionString = getArg('version'); | ||
|
|
||
| if (!versionString) { | ||
| console.error('Error: --version is required'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const classifier = new VersionClassifier(); | ||
| const result = classifier.classify(versionString); | ||
| classifier.output(result); | ||
| } catch (error) { | ||
| console.error(`Error: ${error.message}`); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| export default VersionClassifier; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ on: | |
| - synchronize | ||
| branches: | ||
| - 'master' | ||
| - 'v1.x' | ||
|
|
||
| jobs: | ||
| check-pr-title: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Test v1.x Branch | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - v1.x | ||
| paths-ignore: | ||
| - packages/@n8n/task-runner-python/** | ||
|
|
||
| jobs: | ||
| build-github: | ||
| name: Build for Github Cache | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Setup and Build | ||
| uses: ./.github/actions/setup-nodejs-github | ||
|
|
||
| unit-test: | ||
| name: Unit tests | ||
| uses: ./.github/workflows/units-tests-reusable.yml | ||
| strategy: | ||
| matrix: | ||
| node-version: [20.x, 22.x, 24.3.x] | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| nodeVersion: ${{ matrix.node-version }} | ||
| collectCoverage: ${{ matrix.node-version == '22.x' }} | ||
| secrets: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| lint: | ||
| name: Lint | ||
| uses: ./.github/workflows/linting-reusable.yml | ||
| with: | ||
| ref: ${{ github.sha }} | ||
|
|
||
| notify-on-failure: | ||
| name: Notify Slack on failure | ||
| runs-on: ubuntu-latest | ||
| needs: [unit-test, lint, build-github] | ||
| if: failure() | ||
| steps: | ||
| - name: Notify Slack on failure | ||
| uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | ||
| with: | ||
| status: ${{ job.status }} | ||
| channel: '#alerts-build' | ||
| webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| message: v1.x branch (build or test or lint) failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ on: | |
| - minor | ||
| - major | ||
| - experimental | ||
| - rc | ||
|
|
||
| jobs: | ||
| create-release-pr: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.