From b574e44aee0b3884b742817990576967845ac4af Mon Sep 17 00:00:00 2001 From: "Mr.Dr.Professor Patrick" Date: Tue, 21 Nov 2023 18:28:51 +0100 Subject: [PATCH] chore: add CI workflow (#135) * chore: add CI workflow * fix: fix typings * fix: fix CI workflow * fix: fix CI workflow 2 --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ .github/workflows/deploy.yml | 1 + README.md | 2 ++ next.config.js | 1 + package.json | 3 ++- src/content/components/utils.ts | 2 ++ 6 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000000..528b3aaea685 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + verify_files: + name: Verify Files + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - name: Install Packages + run: npm ci + - name: Shape libs-data.json + run: npm run fetch-data + - name: Lint Files + run: npm run lint + - name: Typecheck + run: npm run typecheck diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 00bba8f516a9..ed5268efa1a1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,6 +30,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} UIKIT_TARGET_BRANCH: 'main' + DATE_COMPONENTS_TARGET_BRANCH: 'main' # Deploy - name: Deploy uses: peaceiris/actions-gh-pages@v3 diff --git a/README.md b/README.md index 732dd41d652b..8dc4ae6bfdf1 100644 --- a/README.md +++ b/README.md @@ -18,5 +18,7 @@ UIKIT_TARGET_BRANCH="your-branch" # default main, target branch for pulling docu COMPONENTS_TARGET_BRANCH="your-branch" # default main, target branch for pulling documentation from components +DATE_COMPONENTS_TARGET_BRANCH="your-branch" # default main, target branch for pulling documentation from date-components + GITHUB_PROFILE="your profile" # default gravity-ui, target profile for pulling documentation from components ``` diff --git a/next.config.js b/next.config.js index 2ac6a298fd91..df8bd257e506 100644 --- a/next.config.js +++ b/next.config.js @@ -73,6 +73,7 @@ module.exports = withPlugins(plugins, { env: { UIKIT_TARGET_BRANCH: process.env.UIKIT_TARGET_BRANCH, COMPONENTS_TARGET_BRANCH: process.env.COMPONENTS_TARGET_BRANCH, + DATE_COMPONENTS_TARGET_BRANCH: process.env.DATE_COMPONENTS_TARGET_BRANCH, }, experimental: { esmExternals: 'loose', diff --git a/package.json b/package.json index 779d0ece920b..45950e8f9b3d 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,8 @@ "lint:prettier": "prettier --check '**/*.md'", "lint": "npm run lint:js && npm run lint:styles && npm run lint:prettier", "predeploy": "npm run build && npm run export", - "deploy": "echo 'gravity-ui.com' > ./build/CNAME && gh-pages -d build" + "deploy": "echo 'gravity-ui.com' > ./build/CNAME && gh-pages -d build", + "typecheck": "tsc --noEmit" }, "browserslist": { "production": [ diff --git a/src/content/components/utils.ts b/src/content/components/utils.ts index 8ad8f333cb12..e9424b617aeb 100644 --- a/src/content/components/utils.ts +++ b/src/content/components/utils.ts @@ -3,11 +3,13 @@ import {Repos} from '../../types/common'; const uikitTargetBranch = process.env.UIKIT_TARGET_BRANCH || TARGET_BRANCH; const componentsTargetBranch = process.env.COMPONENTS_TARGET_BRANCH || TARGET_BRANCH; +const dateComponentsTargetBranch = process.env.DATE_COMPONENTS_TARGET_BRANCH || TARGET_BRANCH; const githubTargetprofile = process.env.GITHUB_PROFILE || TARGET_PROFILE; const TARGET_REPOS_BRANCHES = { [Repos.Uikit]: uikitTargetBranch, [Repos.Components]: componentsTargetBranch, + [Repos.DateComponents]: dateComponentsTargetBranch, }; export type GetterProps = {componentName: string; repoName: Repos};