Skip to content

Commit

Permalink
feat(tools-nx): Added the components internal nx plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed May 27, 2024
1 parent 17cbe4e commit 6af6f78
Show file tree
Hide file tree
Showing 13 changed files with 529 additions and 169 deletions.
163 changes: 142 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,151 @@ on:
- "alpha"
- "beta"

env:
CYCLONE_REGISTRY_ACCESS_KEY: ${{ secrets.CYCLONE_REGISTRY_ACCESS_KEY }}
CYCLONE_REGISTRY_SECRET_KEY: ${{ secrets.CYCLONE_REGISTRY_SECRET_KEY }}

jobs:
release:
uses: storm-software/storm-ops/.github/workflows/ci-reusable.yml@main
with:
tag: ${{ inputs.TAG }}
stormBot: Stormie-Bot
secrets:
githubToken: ${{ secrets.STORM_BOT_GITHUB_TOKEN }}
npmToken: ${{ secrets.STORM_BOT_NPM_TOKEN }}
cargoToken: ${{ secrets.STORM_BOT_CARGO_TOKEN }}
slackToken: ${{ secrets.STORM_BOT_SLACK_TOKEN }}
discordWebhook: ${{ secrets.STORM_BOT_DISCORD_WEBHOOK }}

registry:
name: Publish design components
needs:
- release
if: ${{ success() }}
ci:
name: "Continuous Integration"
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
if: startsWith(github.repository, 'storm-software/') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')
steps:
- name: Send notification - Deployment started
uses: storm-software/action-notify@main
with:
title: "Deployment for ${{ github.repository }} has started (In Progress)"
subtitle: "Deployment for ${{ github.repository }} has started - #${{ github.run_number }}"
description: "Deployment for ${{ github.repository }} is currently in process - #${{ github.run_number }}. \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}."
color: 2077350
status: "In Progress"

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.githubToken }}

- name: Setup workspace
uses: storm-software/action-setup@main
with:
packageManager: ${{ inputs.packageManager }}
packageManagerVersion: ${{ inputs.packageManagerVersion }}
stormBot: ${{ inputs.stormBot }}

- name: Build Cyclone-UI Nx-Plugin packages
run: pnpm build-plugins
shell: bash

- name: Configure git
run: |
git config user.name "${{ inputs.stormBot }}"
git config user.email "${{ inputs.stormBot }}@users.noreply.github.com"
git config lfs.allowincompletepush true
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
shell: bash

- name: Get appropriate base and head commits for `nx affected` commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: "main"

- name: Set appropriate base and head commits for `nx affected` commands
run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
shell: bash

- name: Add permissions to CLI tools
run: chmod a=rwx apps/cli/bin/run.js

- name: Run build script
run: pnpm build-all
shell: bash

- name: Run linters scripts
run: pnpm lint
shell: bash

- name: Super-linter
uses: super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.githubToken }}

- name: Markdown-linter
uses: DavidAnson/markdownlint-cli2-action@v16

- name: Run formatters scripts
run: pnpm nx format
shell: bash

- name: Re-run build script
run: pnpm build-all
shell: bash

- name: Release repository updates
run: pnpm release --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }}
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.npmToken }}
CARGO_REGISTRY_TOKEN: ${{ secrets.cargoToken }}
STORM_BOT: ${{ inputs.stormBot }}
STORM_WORKSPACE_ROOT: ${{ github.workspace }}
STORM_REPOSITORY: ${{ github.repositoryUrl }}
TAG: ${{ inputs.tag }}

- name: Publish design components to Storm CDN Registry
run: pnpm nx run-many -t registry --projects=components/* --parallel=5
shell: bash
env:
CYCLONE_REGISTRY_ACCESS_KEY: ${{ secrets.CYCLONE_REGISTRY_ACCESS_KEY }}
CYCLONE_REGISTRY_SECRET_KEY: ${{ secrets.CYCLONE_REGISTRY_SECRET_KEY }}

success:
needs:
- ci
if: ${{ success() }}
name: Send success notification
runs-on: ubuntu-latest
steps:
- name: Send notification - Deployment successful
uses: storm-software/action-notify@main
with:
title: "Deployment for ${{ github.repository }} has finished (Success)"
subtitle: "Deployment for ${{ github.repository }} has finished successfully - #${{ github.run_number }}"
description: "Deployment for ${{ github.repository }} has finished successfully - #${{ github.run_number }}. \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}."
color: 556891
status: "Success"

failure:
needs:
- ci
if: ${{ failure() }}
name: Send failure notification
runs-on: ubuntu-latest
steps:
- name: Send notification - Deployment successful
uses: storm-software/action-notify@main
with:
title: "Deployment for ${{ github.repository }} has finished (Failure)"
subtitle: "Deployment for ${{ github.repository }} finished with failures - #${{ github.run_number }}"
description: "Deployment for ${{ github.repository }} finished with failures - #${{ github.run_number }}. \nError: ${{ jobs.ci.result }} \nOutput: ${{ jobs.ci.output }} \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}."
color: 10027008
status: "Failure"

cancelled:
needs:
- ci
if: ${{ cancelled() }}
name: Send cancelled notification
runs-on: ubuntu-latest
steps:
- name: Send notification - Deployment cancelled
uses: storm-software/action-notify@main
with:
title: "Deployment for ${{ github.repository }} has finished (Cancelled)"
subtitle: "Deployment for ${{ github.repository }} was cancelled - #${{ github.run_number }}"
description: "Deployment for ${{ github.repository }} was stopped before it could complete - #${{ github.run_number }}. \nError: ${{ jobs.ci.result }} \nOutput: ${{ jobs.ci.output }} \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}."
color: 16565273
status: "Cancelled"
4 changes: 2 additions & 2 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello' command will override the
user-installed or core plugin implementation. This is useful for development work.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello' command will override the user-installed or core
plugin implementation. This is useful for development work.
EXAMPLES
Expand Down
3 changes: 0 additions & 3 deletions components/tabs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
"verbose": true
}
}
},
"registry": {
"executor": "@cyclone-ui/tools-nx:registry"
}
}
}
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
"targetName": "lint"
}
},
"@storm-software/workspace-tools/plugins/typescript"
"@storm-software/workspace-tools/plugins/typescript",
"./dist/plugins/components/index.js"
],
"generators": {
"@nx/react": {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
"api-extractor": "pnpm storm-docs api-extractor --outputPath=\"docs/api-reference\" --clean",
"prebuild": "pnpm clean",
"build": "nx affected -t build --parallel=5",
"build-all": "nx run-many -t build --all --parallel=5 --exclude=\"components/*\"",
"build-all": "pnpm build-plugins && pnpm nx run-many -t build --all --parallel=5 --exclude=\"components/*\"",
"build-apps": "nx run-many -t build --projects=apps/* --parallel=5",
"build-docs": "nx run-many -t build --projects=docs/* --parallel=5",
"build-libs": "nx run-many -t build --projects=libs/* --parallel=5",
"build-plugins": "node -r esbuild-register tools/scripts/build-plugins.ts",
"build-prod": "nx run-many -t build --all --prod --parallel=5",
"build-storybook": "storybook build -s public",
"build-tools": "nx run-many -t build --projects=tools/* --parallel=5",
Expand Down Expand Up @@ -169,6 +170,8 @@
"@swc/helpers": "~0.5.2",
"@vitest/ui": "^1.3.1",
"core-js": "^3.36.1",
"esbuild": "^0.20.2",
"esbuild-register": "^3.5.0",
"eslint-config-next": "14.0.4",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.7.1",
Expand Down
Loading

0 comments on commit 6af6f78

Please sign in to comment.