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/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 000000000..f98b1b88b --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,59 @@ +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 + +permissions: + contents: write + pull-requests: write + +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 }} 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..fc99224cb --- /dev/null +++ b/.github/workflows/release-beta.yml @@ -0,0 +1,30 @@ +name: Beta Pre-release + +on: + push: + branches: + - beta + +permissions: + contents: write + pull-requests: write + +jobs: + release-beta: + runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.beta.json + + publish: + 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 d6af045fc..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: google-github-actions/release-please-action@v4 + - 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 }} 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