Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "angular/**"
pull_request:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "core/**"
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "react/**"
pull_request:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Beta Pre-release

on:
push:
branches:
- beta

permissions:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically the same then the normal release workflow but with an different config file, any possibility in gitlab actions to have some kind of templating?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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 }}
53 changes: 12 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "tokens/**"
pull_request:
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 0 additions & 4 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
35 changes: 35 additions & 0 deletions release-please-config.beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can set the 2 additional configs via process argument?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't find a solution for that, let's keep it as it is for now

"$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"
}