From da59f17de9a90ecc836a131d0cae42a6abade60f Mon Sep 17 00:00:00 2001 From: anastasiia_glushkova Date: Tue, 28 Oct 2025 18:54:24 +0100 Subject: [PATCH 1/3] ci: beta pre-releases --- .github/workflows/angular.yml | 1 + .github/workflows/core.yml | 1 + .github/workflows/react.yml | 1 + .github/workflows/release-beta.yml | 62 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 2 +- .github/workflows/tokens.yml | 1 + package.json | 6 +++ react/package.json | 4 -- release-please-config.beta.json | 35 +++++++++++++++++ 9 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release-beta.yml create mode 100644 release-please-config.beta.json diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index c8c17d7fa..530f941fc 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - beta paths: - "angular/**" pull_request: diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 491737b86..280ddb9e8 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - beta paths: - "core/**" pull_request: diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 34f849f69..51439a5cc 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - beta paths: - "react/**" pull_request: diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml new file mode 100644 index 000000000..50cfc7134 --- /dev/null +++ b/.github/workflows/release-beta.yml @@ -0,0 +1,62 @@ +name: Beta Pre-release + +on: + push: + branches: + - beta + +permissions: + contents: write + pull-requests: write + +jobs: + release-pr: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.beta.json + + publish: + runs-on: ubuntu-latest + needs: release-pr + if: ${{ needs.release-pr.outputs.releases_created }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + registry-url: "https://registry.npmjs.org" + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Publish to npm with @beta tag + run: pnpm run publish:beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6af045fc..537abc944 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v4 + - uses: googleapis/release-please-action@v4 id: release - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/tokens.yml b/.github/workflows/tokens.yml index 5195a4512..988b685cd 100644 --- a/.github/workflows/tokens.yml +++ b/.github/workflows/tokens.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - beta paths: - "tokens/**" pull_request: diff --git a/package.json b/package.json index 1ea42ab38..04d868e9f 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,17 @@ "build": "pnpm run build:tokens && pnpm run build:core && pnpm run build:angular && pnpm run build:angular-formly && pnpm run build:react", "postbuild": "pnpm --filter @haiilo/catalyst-angular-workspace run prettier", "publish:tokens": "pnpm --filter @haiilo/catalyst-tokens publish", + "publish:tokens:beta": "pnpm --filter @haiilo/catalyst-tokens publish --tag beta --no-git-checks", "publish:core": "pnpm --filter @haiilo/catalyst publish", + "publish:core:beta": "pnpm --filter @haiilo/catalyst publish --tag beta --no-git-checks", "publish:angular": "cd angular/dist/catalyst && pnpm publish", + "publish:angular:beta": "cd angular/dist/catalyst && pnpm publish --tag beta --no-git-checks", "publish:angular-formly": "cd angular/dist/catalyst-formly && pnpm publish", + "publish:angular-formly:beta": "cd angular/dist/catalyst-formly && pnpm publish --tag beta --no-git-checks", "publish:react": "pnpm --filter @haiilo/catalyst-react publish", + "publish:react:beta": "pnpm --filter @haiilo/catalyst-react publish --tag beta --no-git-checks", "publish": "pnpm run publish:tokens && pnpm run publish:core && pnpm run publish:angular && pnpm run publish:angular-formly && pnpm run publish:react", + "publish:beta": "pnpm run publish:tokens:beta && pnpm run publish:core:beta && pnpm run publish:angular:beta && pnpm run publish:angular-formly:beta && pnpm run publish:react:beta", "clean": "pnpm run -r clean", "reset": "pnpm run -r reset && rm -rf ./node_modules" }, diff --git a/react/package.json b/react/package.json index 9faffa787..0e467487a 100644 --- a/react/package.json +++ b/react/package.json @@ -7,10 +7,6 @@ "access": "public" }, "sideEffects": false, - "repository": { - "type": "git", - "url": "https://github.com/ionic-team/ionic.git" - }, "scripts": { "prebuild": "pnpm run clean", "build": "pnpm run tsc", diff --git a/release-please-config.beta.json b/release-please-config.beta.json new file mode 100644 index 000000000..c51a54007 --- /dev/null +++ b/release-please-config.beta.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + "tokens": { + "component": "catalyst-tokens" + }, + "core": { + "component": "catalyst-core" + }, + "angular/projects/catalyst": { + "component": "catalyst-angular" + }, + "angular/projects/catalyst-formly": { + "component": "catalyst-angular-formly" + }, + "react": { + "component": "catalyst-react" + } + }, + "plugins": [ + { + "type": "linked-versions", + "groupName": "catalyst", + "components": [ + "catalyst-tokens", + "catalyst-core", + "catalyst-angular", + "catalyst-angular-formly", + "catalyst-react" + ] + } + ], + "prerelease": true, + "prerelease-type": "beta" +} \ No newline at end of file From e52cfb6e61d6bcd08cd17a4f872d65f0023a4515 Mon Sep 17 00:00:00 2001 From: anastasiia_glushkova Date: Wed, 29 Oct 2025 10:49:15 +0100 Subject: [PATCH 2/3] ci: move duplication from release and pre-release github workflows to a separate job --- .github/workflows/build-and-publish.yml | 55 +++++++++++++++++++++++++ .github/workflows/release-beta.yml | 52 +++++------------------ .github/workflows/release.yml | 51 +++++------------------ 3 files changed, 76 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/build-and-publish.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 000000000..07acc651c --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,55 @@ +name: Build and Publish (Reusable) + +on: + workflow_call: + inputs: + publish-script: + description: 'The npm script to run for publishing (e.g., "publish" or "publish:beta")' + required: true + type: string + secrets: + NPM_TOKEN: + description: 'NPM authentication token' + required: true + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + registry-url: "https://registry.npmjs.org" + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Publish to npm + run: pnpm run ${{ inputs.publish-script }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 50cfc7134..fc99224cb 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -10,8 +10,10 @@ permissions: pull-requests: write jobs: - release-pr: + release-beta: runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} steps: - uses: googleapis/release-please-action@v4 id: release @@ -19,44 +21,10 @@ jobs: config-file: release-please-config.beta.json publish: - runs-on: ubuntu-latest - needs: release-pr - if: ${{ needs.release-pr.outputs.releases_created }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version-file: .nvmrc - registry-url: "https://registry.npmjs.org" - - - name: Setup pnpm - uses: pnpm/action-setup@v3 - with: - version: 9 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install - run: pnpm install - - - name: Build - run: pnpm run build - - - name: Publish to npm with @beta tag - run: pnpm run publish:beta - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + needs: release-beta + if: ${{ fromJSON(needs.release-pr.outputs.releases_created) }} + uses: ./.github/workflows/build-and-publish.yml + with: + publish-script: "publish:beta" + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 537abc944..44d5c8f5f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,46 +12,17 @@ permissions: jobs: release: runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} steps: - uses: googleapis/release-please-action@v4 id: release - - name: Checkout - uses: actions/checkout@v4 - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version-file: .nvmrc - registry-url: "https://registry.npmjs.org" - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Setup pnpm - uses: pnpm/action-setup@v3 - with: - version: 9 - run_install: false - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Get pnpm store directory - shell: bash - run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Install - run: pnpm install - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Build - run: pnpm run build - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - name: Install (again - testing...) - run: pnpm install - if: ${{ fromJSON(steps.release.outputs.releases_created) }} - - run: pnpm run publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ fromJSON(steps.release.outputs.releases_created) }} + + publish: + needs: release + if: ${{ fromJSON(needs.release.outputs.releases_created) }} + uses: ./.github/workflows/build-and-publish.yml + with: + publish-script: "publish" + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 14c9822a97773ceb96d57028128bdd5f1549a457 Mon Sep 17 00:00:00 2001 From: anastasiia_glushkova Date: Wed, 29 Oct 2025 10:56:42 +0100 Subject: [PATCH 3/3] ci: add permissions --- .github/workflows/build-and-publish.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 07acc651c..f98b1b88b 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -12,6 +12,10 @@ on: description: 'NPM authentication token' required: true +permissions: + contents: write + pull-requests: write + jobs: build-and-publish: runs-on: ubuntu-latest @@ -52,4 +56,4 @@ jobs: - name: Publish to npm run: pnpm run ${{ inputs.publish-script }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}