From d435205ea6cb432142ede5374b2887d017177214 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 18:35:08 +0700 Subject: [PATCH 1/6] feat: action-to-manually-deploy-internal-versions --- .github/workflows/publish-internal.yml | 25 ++++++++++ test/e2e-pipeline.mjs | 64 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/publish-internal.yml create mode 100644 test/e2e-pipeline.mjs diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml new file mode 100644 index 0000000..b15424c --- /dev/null +++ b/.github/workflows/publish-internal.yml @@ -0,0 +1,25 @@ +name: Publish Internal NPM Package + +on: + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + package: + runs-on: ubuntu-latest + name: Publish Internal NPM Package + + steps: + - name: Cloning repo + uses: actions/checkout@v5 + + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + registry-url: 'https://registry.npmjs.org' + + - run: npm i + - run: npm run build && npm test && cd ./lib/flagsmith/ && npm publish --tag internal --access public && cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public diff --git a/test/e2e-pipeline.mjs b/test/e2e-pipeline.mjs new file mode 100644 index 0000000..a698162 --- /dev/null +++ b/test/e2e-pipeline.mjs @@ -0,0 +1,64 @@ +/** + * E2E test: JS client -> pipeline server -> MinIO (parquet) + * + * Prerequisites: + * - Pipeline server running on localhost:8080 + * - MinIO running on localhost:9000 (console on 9001) + * + * Usage: + * node test/e2e-pipeline.mjs + */ + +import flagsmith from '../lib/flagsmith/index.mjs'; + +const runId = Math.random().toString(36).slice(2, 8); +const ENVIRONMENT_KEY = `e2e_test_${runId}`; +const PIPELINE_URL = 'http://localhost:8080/'; +const identity = `user_${runId}`; + +const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; +const randomBool = () => Math.random() > 0.5; +const randomString = () => Math.random().toString(36).slice(2, 10); + +const defaultFlags = { + hero: { enabled: randomBool(), value: randomString() }, + font_size: { enabled: true, value: randomInt(8, 48) }, + beta_feature: { enabled: randomBool(), value: null }, + theme: { enabled: true, value: randomBool() ? 'dark' : 'light' }, +}; + +await flagsmith.init({ + environmentID: ENVIRONMENT_KEY, + identity, + traits: { plan: 'pro', score: randomInt(1, 100) }, + evaluationAnalyticsConfig: { + analyticsServerUrl: PIPELINE_URL, + flushInterval: 3000, + }, + defaultFlags, + preventFetch: true, + fetch: globalThis.fetch, +}); + +console.log(`Run ID: ${runId}`); +console.log(`Environment: ${ENVIRONMENT_KEY}`); +console.log(`Identity: ${identity}`); +console.log(`Default flags:`, JSON.stringify(defaultFlags, null, 2)); +console.log('\nEvaluating flags...'); + +console.log(' hero value:', flagsmith.getValue('hero')); +console.log(' font_size value:', flagsmith.getValue('font_size')); +console.log(' hero enabled:', flagsmith.hasFeature('hero')); +console.log(' beta_feature enabled:', flagsmith.hasFeature('beta_feature')); +console.log(' theme value:', flagsmith.getValue('theme')); + +console.log(`\nWaiting for flush (3s)...`); + +await new Promise((resolve) => setTimeout(resolve, 4000)); + +console.log('Done. Check:'); +console.log(' - Pipeline server logs for ingested events'); +console.log(' - MinIO console at http://localhost:9001 for parquet files'); +console.log(' - Or run: docker exec minio mc ls local/flagsmith-analytics/ --recursive'); + +process.exit(0); From 95f9fea491a9c6c0d11cbeea42d30f51e564f043 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 18:36:31 +0700 Subject: [PATCH 2/6] feat: action-to-manually-deploy-internal-versions --- .github/workflows/publish-internal.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/publish-internal.yml diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml new file mode 100644 index 0000000..b15424c --- /dev/null +++ b/.github/workflows/publish-internal.yml @@ -0,0 +1,25 @@ +name: Publish Internal NPM Package + +on: + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + package: + runs-on: ubuntu-latest + name: Publish Internal NPM Package + + steps: + - name: Cloning repo + uses: actions/checkout@v5 + + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + registry-url: 'https://registry.npmjs.org' + + - run: npm i + - run: npm run build && npm test && cd ./lib/flagsmith/ && npm publish --tag internal --access public && cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public From 21bbb94b79b976e368b461dd2c450736b64f5995 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 18:38:01 +0700 Subject: [PATCH 3/6] feat: removed-local-test-file --- test/e2e-pipeline.mjs | 64 ------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 test/e2e-pipeline.mjs diff --git a/test/e2e-pipeline.mjs b/test/e2e-pipeline.mjs deleted file mode 100644 index a698162..0000000 --- a/test/e2e-pipeline.mjs +++ /dev/null @@ -1,64 +0,0 @@ -/** - * E2E test: JS client -> pipeline server -> MinIO (parquet) - * - * Prerequisites: - * - Pipeline server running on localhost:8080 - * - MinIO running on localhost:9000 (console on 9001) - * - * Usage: - * node test/e2e-pipeline.mjs - */ - -import flagsmith from '../lib/flagsmith/index.mjs'; - -const runId = Math.random().toString(36).slice(2, 8); -const ENVIRONMENT_KEY = `e2e_test_${runId}`; -const PIPELINE_URL = 'http://localhost:8080/'; -const identity = `user_${runId}`; - -const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; -const randomBool = () => Math.random() > 0.5; -const randomString = () => Math.random().toString(36).slice(2, 10); - -const defaultFlags = { - hero: { enabled: randomBool(), value: randomString() }, - font_size: { enabled: true, value: randomInt(8, 48) }, - beta_feature: { enabled: randomBool(), value: null }, - theme: { enabled: true, value: randomBool() ? 'dark' : 'light' }, -}; - -await flagsmith.init({ - environmentID: ENVIRONMENT_KEY, - identity, - traits: { plan: 'pro', score: randomInt(1, 100) }, - evaluationAnalyticsConfig: { - analyticsServerUrl: PIPELINE_URL, - flushInterval: 3000, - }, - defaultFlags, - preventFetch: true, - fetch: globalThis.fetch, -}); - -console.log(`Run ID: ${runId}`); -console.log(`Environment: ${ENVIRONMENT_KEY}`); -console.log(`Identity: ${identity}`); -console.log(`Default flags:`, JSON.stringify(defaultFlags, null, 2)); -console.log('\nEvaluating flags...'); - -console.log(' hero value:', flagsmith.getValue('hero')); -console.log(' font_size value:', flagsmith.getValue('font_size')); -console.log(' hero enabled:', flagsmith.hasFeature('hero')); -console.log(' beta_feature enabled:', flagsmith.hasFeature('beta_feature')); -console.log(' theme value:', flagsmith.getValue('theme')); - -console.log(`\nWaiting for flush (3s)...`); - -await new Promise((resolve) => setTimeout(resolve, 4000)); - -console.log('Done. Check:'); -console.log(' - Pipeline server logs for ingested events'); -console.log(' - MinIO console at http://localhost:9001 for parquet files'); -console.log(' - Or run: docker exec minio mc ls local/flagsmith-analytics/ --recursive'); - -process.exit(0); From 64978614aa4fabbba5c48e13916346afcc28a589 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 18:42:04 +0700 Subject: [PATCH 4/6] feat: added-template-md --- .github/pull_request_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..b28bcbb --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,21 @@ +Thanks for submitting a PR! Please check the boxes below: + +- [ ] I have read the [Contributing Guide](/Flagsmith/flagsmith/blob/main/CONTRIBUTING.md). +- [ ] I have added information to `docs/` if required so people know about the feature. +- [ ] I have filled in the "Changes" section below. +- [ ] I have filled in the "How did you test this code" section below. + +## Changes + +Contributes to + + + +_Please describe._ + +## How did you test this code? + + + +_Please describe._ From 34b9a2d51aa82d02ec2c030985acba0b17eaa067 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 20:42:55 +0700 Subject: [PATCH 5/6] feat: suffix-internal-version-in-action --- .github/workflows/pull-request.yml | 31 +++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 85b3127..531e30a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,23 +1,40 @@ -name: Pull Requests +name: Publish Internal NPM Package on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: +permissions: + id-token: write + contents: read jobs: package: runs-on: ubuntu-latest - name: Test + name: Publish Internal NPM Package steps: - name: Cloning repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + registry-url: 'https://registry.npmjs.org' - run: npm i - - run: npm run build - - run: npm test + + - name: Set internal version + run: | + VERSION=$(node -p "require('./lib/flagsmith/package.json').version") + INTERNAL="${VERSION}-internal.${{ github.run_number }}" + echo "Publishing version: $INTERNAL" + cd lib/flagsmith && npm version $INTERNAL --no-git-tag-version + cd ../../lib/react-native-flagsmith && npm version $INTERNAL --no-git-tag-version + + - name: Build and test + run: npm run build && npm test + + - name: Publish + run: | + cd lib/flagsmith && npm publish --tag internal --access public + cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public From 4d3b843721fde6d631a6b5764b8649d183c5b189 Mon Sep 17 00:00:00 2001 From: wadii Date: Wed, 4 Mar 2026 20:50:49 +0700 Subject: [PATCH 6/6] feat: reverted-internal-pipeline-to-correct-file --- .github/workflows/publish-internal.yml | 17 +++++++++++++- .github/workflows/pull-request.yml | 31 ++++++-------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index b15424c..531e30a 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -22,4 +22,19 @@ jobs: registry-url: 'https://registry.npmjs.org' - run: npm i - - run: npm run build && npm test && cd ./lib/flagsmith/ && npm publish --tag internal --access public && cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public + + - name: Set internal version + run: | + VERSION=$(node -p "require('./lib/flagsmith/package.json').version") + INTERNAL="${VERSION}-internal.${{ github.run_number }}" + echo "Publishing version: $INTERNAL" + cd lib/flagsmith && npm version $INTERNAL --no-git-tag-version + cd ../../lib/react-native-flagsmith && npm version $INTERNAL --no-git-tag-version + + - name: Build and test + run: npm run build && npm test + + - name: Publish + run: | + cd lib/flagsmith && npm publish --tag internal --access public + cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 531e30a..85b3127 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,40 +1,23 @@ -name: Publish Internal NPM Package +name: Pull Requests on: - workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] -permissions: - id-token: write - contents: read jobs: package: runs-on: ubuntu-latest - name: Publish Internal NPM Package + name: Test steps: - name: Cloning repo - uses: actions/checkout@v5 + uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .nvmrc - registry-url: 'https://registry.npmjs.org' - run: npm i - - - name: Set internal version - run: | - VERSION=$(node -p "require('./lib/flagsmith/package.json').version") - INTERNAL="${VERSION}-internal.${{ github.run_number }}" - echo "Publishing version: $INTERNAL" - cd lib/flagsmith && npm version $INTERNAL --no-git-tag-version - cd ../../lib/react-native-flagsmith && npm version $INTERNAL --no-git-tag-version - - - name: Build and test - run: npm run build && npm test - - - name: Publish - run: | - cd lib/flagsmith && npm publish --tag internal --access public - cd ../../lib/react-native-flagsmith && npm publish --tag internal --access public + - run: npm run build + - run: npm test