Skip to content

Commit

Permalink
chore: add CI workflow (#135)
Browse files Browse the repository at this point in the history
* chore: add CI workflow

* fix: fix typings

* fix: fix CI workflow

* fix: fix CI workflow 2
  • Loading branch information
korvin89 authored Nov 21, 2023
1 parent cd8f803 commit b574e44
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 2 additions & 0 deletions src/content/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit b574e44

Please sign in to comment.