From b6c991412d99562535fee7a912c6e6daaa1fbf19 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:34 -0500 Subject: [PATCH 01/16] chore(publish): remove version policy from non publishable packages --- .github/workflows/publish.yml | 54 ++--------- common/config/rush/version-policies.json | 110 +---------------------- common/scripts/github-actions.js | 56 +++++++++--- rush.json | 18 ---- 4 files changed, 50 insertions(+), 188 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d8d688c9..89c81458 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,6 @@ jobs: token: ${{ secrets.PAT_TOKEN }} - name: CFDI dependencies - id: cfdi uses: ./.github/actions/cfdi with: token: ${{ secrets.PAT_TOKEN }} @@ -52,63 +51,22 @@ jobs: - name: Publish (main) if: steps.branch.outputs.is_main == 'true' - run: | - SCOPES='${{ steps.cfdi.outputs.scopes }}' - - # --- Fase 1: Bump de TODOS los scopes --- - echo "========== PHASE 1: VERSION BUMP ==========" - for scope in $(echo "$SCOPES" | jq -r '.[]'); do - echo "=== Bumping $scope ===" - rush version --version-policy "$scope" --bump - done - - # --- Fase 2: Un solo publish (Rush maneja orden topológico) --- - echo "========== PHASE 2: PUBLISH ==========" - if rush publish -p -b main --set-access-level=public; then - git add -A - echo "✓ Publish exitoso" - else - echo "::error::Publish falló" - exit 1 - fi + run: rush publish -p -b main --include-all --set-access-level=public - name: Publish (prerelease) if: steps.branch.outputs.is_main == 'false' - run: | - TAG="${{ steps.branch.outputs.name }}" - SCOPES='${{ steps.cfdi.outputs.scopes }}' - - # --- Fase 1: Bump de TODOS los scopes --- - echo "========== PHASE 1: VERSION BUMP ==========" - for scope in $(echo "$SCOPES" | jq -r '.[]'); do - echo "=== Bumping $scope ===" - rush version --version-policy "$scope" --bump --override-bump prerelease --override-prerelease-id "$TAG" - done - - # --- Fase 2: Un solo publish (Rush maneja orden topológico) --- - echo "========== PHASE 2: PUBLISH ==========" - if rush publish --publish --tag "$TAG" --set-access-level=public --apply; then - git add -A - echo "✓ Publish exitoso" - else - echo "::error::Publish falló" - exit 1 - fi + run: rush publish --publish --tag ${{ steps.branch.outputs.name }} --include-all --set-access-level=public --apply - name: Commit version bumps run: | BRANCH="${{ steps.branch.outputs.name }}" git add -A - if [ -n "$(git diff --cached --name-only)" ]; then - if [ "$BRANCH" = "main" ]; then - git commit -m "chore: release $(date +%Y-%m-%d)" - else - git commit -m "chore: prerelease $BRANCH $(date +%Y-%m-%d)" - fi - git push origin $BRANCH + if [ "$BRANCH" = "main" ]; then + git commit -m "chore: release $(date +%Y-%m-%d)" || echo "No changes to commit" else - echo "No changes to commit" + git commit -m "chore: prerelease $BRANCH $(date +%Y-%m-%d)" || echo "No changes to commit" fi + git push origin $BRANCH - name: Create GitHub Releases run: node common/scripts/github-release.js diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 16cd96b7..4687630a 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -29,24 +29,6 @@ "version": "4.0.16-dev.3", "nextBump": "patch" }, - { - "policyName": "pdf", - "definitionName": "lockStepVersion", - "version": "0.0.10-dev.0", - "nextBump": "prerelease" - }, - { - "policyName": "auth", - "definitionName": "lockStepVersion", - "version": "1.0.1", - "nextBump": "patch" - }, - { - "policyName": "curp", - "definitionName": "lockStepVersion", - "version": "0.0.10-beta.2", - "nextBump": "prerelease" - }, { "policyName": "rfc", "definitionName": "lockStepVersion", @@ -62,7 +44,7 @@ { "policyName": "openssl", "definitionName": "lockStepVersion", - "version": "0.0.17-dev.2", + "version": "0.0.17-dev.3", "nextBump": "patch" }, { @@ -106,95 +88,5 @@ "definitionName": "lockStepVersion", "version": "4.0.14-dev.2", "nextBump": "patch" - }, - { - "policyName": "designs", - "definitionName": "lockStepVersion", - "version": "4.0.13", - "nextBump": "patch" - }, - { - "policyName": "cleaner", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "estado", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "validador", - "definitionName": "lockStepVersion", - "version": "0.0.1-beta.0", - "nextBump": "prerelease" - }, - { - "policyName": "descarga", - "definitionName": "lockStepVersion", - "version": "0.0.1-beta.0", - "nextBump": "prerelease" - }, - { - "policyName": "cancelacion", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "recursos", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "scraper", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "opinion", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "contabilidad", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "captcha", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "retenciones", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "pacs", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "banxico", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" - }, - { - "policyName": "diot", - "definitionName": "lockStepVersion", - "version": "0.0.1", - "nextBump": "patch" } ] diff --git a/common/scripts/github-actions.js b/common/scripts/github-actions.js index 1a38dff1..62d0d6eb 100644 --- a/common/scripts/github-actions.js +++ b/common/scripts/github-actions.js @@ -1,4 +1,27 @@ +async function execa(command, params) { + const { spawn } = require('child_process'); + const child = spawn(command, params); + + let data = ''; + for await (const chunk of child.stdout) { + //console.log('stdout chunk: ' + chunk); + data += chunk; + } + let error = ''; + for await (const chunk of child.stderr) { + //console.error('stderr chunk: ' + chunk); + error += chunk; + } + const exitCode = await new Promise((resolve, reject) => { + child.on('close', resolve); + }); + + if (exitCode) { + throw new Error(`subprocess error exit ${exitCode}, ${error}`); + } + return data; +} function getDependences(scope) { const dependencies = { xml: { @@ -178,6 +201,7 @@ module.exports = async ({ github, context, core }) => { console.log("branch:", branch); console.log("eventName:", context.eventName); + const branchs = ['next','beta', 'alpha','dev'] const eventName = context.eventName let commits = context.payload.commits || []; @@ -195,18 +219,24 @@ module.exports = async ({ github, context, core }) => { commits = commits_local.map(({commit})=>commit) } const scopes = getScopes(commits); - console.log("scopes from commits", scopes); - - // Filtrar scopes que no tienen shouldPublish: true - const rushJson = JSON.parse(require('fs').readFileSync('./rush.json', 'utf8')); - const publishablePolicies = new Set( - rushJson.projects - .filter(p => p.shouldPublish && p.versionPolicyName) - .map(p => p.versionPolicyName) - ); - const filteredScopes = scopes.filter(s => publishablePolicies.has(s)); - console.log("publishable scopes", filteredScopes); + console.log("commits", scopes); - core.setOutput('scopes', JSON.stringify(filteredScopes)); - core.setOutput('branch', branch); + for (var i = 0; i < scopes.length; i++) { + const scope = scopes[i]; + const comands = [ + 'version', + '--version-policy', + scope, + '--bump', + ] + if (branchs.includes(branch)) { + comands.push('--override-bump'); + comands.push('prerelease'); + comands.push('--override-prerelease-id'); + comands.push(branch); + } + console.log(comands); + const data = await execa('rush', comands); + console.log(data); + } }; diff --git a/rush.json b/rush.json index 9ce4ca36..e8bb4d5a 100644 --- a/rush.json +++ b/rush.json @@ -120,7 +120,6 @@ { "packageName": "@cfdi/pdf", "projectFolder": "packages/cfdi/pdf", - "versionPolicyName": "pdf", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -137,7 +136,6 @@ { "packageName": "@renapo/curp", "projectFolder": "packages/renapo/curp", - "versionPolicyName": "curp", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -185,7 +183,6 @@ { "packageName": "@cfdi/estado", "projectFolder": "packages/cfdi/estado", - "versionPolicyName": "estado", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -195,7 +192,6 @@ { "packageName": "@cfdi/descarga", "projectFolder": "packages/cfdi/descarga", - "versionPolicyName": "descarga", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -205,7 +201,6 @@ { "packageName": "@sat/recursos", "projectFolder": "packages/sat/recursos", - "versionPolicyName": "recursos", "reviewCategory": "libraries", "shouldPublish": false }, @@ -233,14 +228,12 @@ { "packageName": "@cfdi/designs", "projectFolder": "packages/cfdi/designs", - "versionPolicyName": "designs", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/auth", "projectFolder": "packages/sat/auth", - "versionPolicyName": "auth", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -250,7 +243,6 @@ { "packageName": "@cfdi/validador", "projectFolder": "packages/cfdi/validador", - "versionPolicyName": "validador", "reviewCategory": "libraries", "shouldPublish": false, "tags": [ @@ -260,70 +252,60 @@ { "packageName": "@cfdi/cleaner", "projectFolder": "packages/cfdi/cleaner", - "versionPolicyName": "cleaner", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@cfdi/cancelacion", "projectFolder": "packages/cfdi/cancelacion", - "versionPolicyName": "cancelacion", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@cfdi/retenciones", "projectFolder": "packages/cfdi/retenciones", - "versionPolicyName": "retenciones", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/scraper", "projectFolder": "packages/sat/scraper", - "versionPolicyName": "scraper", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/opinion", "projectFolder": "packages/sat/opinion", - "versionPolicyName": "opinion", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/contabilidad", "projectFolder": "packages/sat/contabilidad", - "versionPolicyName": "contabilidad", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/captcha", "projectFolder": "packages/sat/captcha", - "versionPolicyName": "captcha", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/pacs", "projectFolder": "packages/sat/pacs", - "versionPolicyName": "pacs", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/banxico", "projectFolder": "packages/sat/banxico", - "versionPolicyName": "banxico", "reviewCategory": "libraries", "shouldPublish": false }, { "packageName": "@sat/diot", "projectFolder": "packages/sat/diot", - "versionPolicyName": "diot", "reviewCategory": "libraries", "shouldPublish": false }, From fa0198f565cbdf26bcccd1d1183c6b20d59ad457 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:42 -0500 Subject: [PATCH 02/16] chore(xml): test publish workflow From 5f060ed44e450ce9e88c7826593b9322601a55c2 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:43 -0500 Subject: [PATCH 03/16] chore(complementos): test publish workflow From 8df48c3b0a40632a35e71e1fc4668c13397fc1a8 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:44 -0500 Subject: [PATCH 04/16] chore(xsd): test publish workflow From 4b0b08440b718fa4d45e0825f55d6fcfd2fc2e4e Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:45 -0500 Subject: [PATCH 05/16] chore(csd): test publish workflow From b5ebe09f4e10bd44fef951cf283e8a4bd7882b98 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:46 -0500 Subject: [PATCH 06/16] chore(csf): test publish workflow From 3059e5b7ff8372865bb6413f54d63d14f85d34a1 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:47 -0500 Subject: [PATCH 07/16] chore(catalogs): test publish workflow From 035667541ee3f42faa385b85da9e2718d10ea7c8 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:48 -0500 Subject: [PATCH 08/16] chore(utils): test publish workflow From da41074d7a4bf7bb0128e1b741a285647a2409f4 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:49 -0500 Subject: [PATCH 09/16] chore(rfc): test publish workflow From 4823574ced1bad4435e7dddeaf2114facb579dc3 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:50 -0500 Subject: [PATCH 10/16] chore(openssl): test publish workflow From 9be7bdf25ccf9dd77236d083054ab57bafb248fa Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:51 -0500 Subject: [PATCH 11/16] chore(saxon): test publish workflow From 08d09aeece60626c955094a9b2973924c4cc84fb Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:52 -0500 Subject: [PATCH 12/16] chore(types): test publish workflow From 7b829092d5c30e8d6191b488e48d933fcd8b2f42 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:53 -0500 Subject: [PATCH 13/16] chore(transform): test publish workflow From b3d5fd49e91c2d91674803da73e319c7f8e2fc47 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:54 -0500 Subject: [PATCH 14/16] chore(2json): test publish workflow From 97aa722c28d3e770008d5a347245c233d05391bb Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:56 -0500 Subject: [PATCH 15/16] chore(expresiones): test publish workflow From 51acc05bbcd6851fe5d58b3e868e3fe41a5ef1f4 Mon Sep 17 00:00:00 2001 From: MisaelMa Date: Tue, 7 Apr 2026 22:56:57 -0500 Subject: [PATCH 16/16] chore(elements): test publish workflow