[general] Remove unnecessary dependencies (#329) #562
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "build" | |
on: | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
push: | |
branches: | |
- "main" | |
tags: | |
- v* | |
schedule: | |
- cron: "0 8 * * 1" # At 08:00 on Monday | |
jobs: | |
qa: | |
name: "Code quality assurance" | |
runs-on: "${{ matrix.operating-system }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
- name: "Get Yarn cache directory" | |
id: "yarn-cache-dir-path" | |
run: 'echo "::set-output name=dir::$(yarn cache dir)"' | |
- name: "Cache JS dependencies" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.yarn-cache-dir-path.outputs.dir }}" | |
key: "${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}" | |
restore-keys: "${{ runner.os }}-node-modules-" | |
- name: "Install dependencies" | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: "yarn install" | |
- name: "Check Prettier with eslint" | |
run: "yarn pretty:check" | |
lint: | |
name: "Code linting" | |
runs-on: "${{ matrix.operating-system }}" | |
strategy: | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
fail-fast: false | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
- name: "Get Yarn cache directory" | |
id: "yarn-cache-dir-path" | |
run: 'echo "::set-output name=dir::$(yarn cache dir)"' | |
- name: "Cache JS dependencies" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.yarn-cache-dir-path.outputs.dir }}" | |
key: "${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}" | |
restore-keys: "${{ runner.os }}-node-modules-" | |
- name: "Install dependencies" | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: "yarn install" | |
- name: "Check js linter" | |
run: "yarn lint:js" | |
- name: "Check styles linter" | |
run: "yarn lint:styles" | |
build-docs: | |
name: "Test build Storybook" | |
runs-on: "${{ matrix.operating-system }}" | |
strategy: | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
fail-fast: false | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
- name: "Get Yarn cache directory" | |
id: "yarn-cache-dir-path" | |
run: 'echo "::set-output name=dir::$(yarn cache dir)"' | |
- name: "Cache JS dependencies" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.yarn-cache-dir-path.outputs.dir }}" | |
key: "${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}" | |
restore-keys: "${{ runner.os }}-node-modules-" | |
- name: "Install dependencies" | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: "yarn install" | |
- name: "Test build" | |
run: "yarn build" | |
publish-npmjs: | |
name: "Build library and publish it to NPM" | |
runs-on: "${{ matrix.operating-system }}" | |
needs: [ "qa", "lint", "build-docs" ] | |
strategy: | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Install node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
registry-url: "https://registry.npmjs.org" | |
- name: "Extract version" | |
uses: "battila7/get-version-action@v2" | |
id: "get_version" | |
- name: "Install package dependencies" | |
run: "yarn install" | |
- name: "Set up git since we will later push to the repo" | |
run: | | |
git config --global user.name "GitHub CD bot" | |
git config --global user.email "code@fastybird.com" | |
- name: "Upgrade npm version in package.json to the tag used in the release" | |
if: contains(github.ref, 'refs/tags/') | |
run: "npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version" | |
- name: "Build the project" | |
run: "yarn build" | |
- name: "Publish WebUI library to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_library_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
package: "./web-ui-library" | |
- name: "Publish WebUI library to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_library_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI library to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_library_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./web-ui-library" | |
- name: "Publish WebUI library to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_library_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Icons to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_icons_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
package: "./packages/icons" | |
- name: "Publish WebUI Icons to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_icons_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Icons to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_icons_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./packages/icons" | |
- name: "Publish WebUI Icons to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_icons_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Theme Chalk to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_theme_chalk_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
package: "./packages/theme-chalk" | |
- name: "Publish WebUI Theme Chalk to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_theme_chalk_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Theme Chalk to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_theme_chalk_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.NPMJS_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./packages/theme-chalk" | |
- name: "Publish WebUI Theme Chalk to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_theme_chalk_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
publish-github: | |
name: "Build library and publish it to Github packages" | |
runs-on: "${{ matrix.operating-system }}" | |
needs: [ "qa", "lint", "build-docs" ] | |
strategy: | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Install node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
registry-url: "https://npm.pkg.github.com" | |
- name: "Extract version" | |
uses: "battila7/get-version-action@v2" | |
id: "get_version" | |
- name: "Install package dependencies" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: "yarn install" | |
- name: "Set up git since we will later push to the repo" | |
run: | | |
git config --global user.name "GitHub CD bot" | |
git config --global user.email "code@fastybird.com" | |
- name: "Upgrade npm version in package.json to the tag used in the release" | |
if: contains(github.ref, 'refs/tags/') | |
run: "npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version" | |
- name: "Build the project" | |
run: "yarn build" | |
- name: "Publish WebUI library to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_library_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
package: "./web-ui-library" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI library to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_library_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI library to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_library_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./web-ui-library" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI library to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_library_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Icons to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_icons_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
package: "./packages/icons" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI Icons to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_icons_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Icons to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_icons_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./packages/icons" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI Icons to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_icons_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Theme Chalk to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_theme_chalk_publish" | |
if: contains(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
package: "./packages/theme-chalk" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI Theme Chalk to NPM result" | |
if: contains(github.ref, 'refs/tags/') && steps.npm_theme_chalk_publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
- name: "Publish WebUI Theme Chalk to NPM" | |
uses: "JS-DevTools/npm-publish@v3" | |
id: "npm_theme_chalk_publish_dev" | |
if: contains(github.ref, 'refs/tags/') == false | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
access: "public" | |
tag: "dev" | |
package: "./packages/theme-chalk" | |
registry: "https://npm.pkg.github.com" | |
- name: "Publish WebUI Theme Chalk to NPM result" | |
if: contains(github.ref, 'refs/tags/') == false && steps.npm_theme_chalk_publish_dev.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
publish-docs: | |
name: "Build Storybook and publish it to Github pages" | |
runs-on: "${{ matrix.operating-system }}" | |
needs: [ "qa", "lint", "build-docs" ] | |
strategy: | |
matrix: | |
node-version: [ "20" ] | |
operating-system: [ "ubuntu-latest" ] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main') | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
with: | |
persist-credentials: false | |
- name: "Setup node" | |
uses: "actions/setup-node@v4" | |
with: | |
node-version: "${{ matrix.node-version }}" | |
- name: "Get Yarn cache directory" | |
id: "yarn-cache-dir-path" | |
run: 'echo "::set-output name=dir::$(yarn cache dir)"' | |
- name: "Cache JS dependencies" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.yarn-cache-dir-path.outputs.dir }}" | |
key: "${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}" | |
restore-keys: "${{ runner.os }}-node-modules-" | |
- name: "Install dependencies" | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: "yarn install" | |
- name: "Build" | |
run: "yarn build" | |
- name: "Deploy" | |
uses: "JamesIves/github-pages-deploy-action@3.6.2" | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: "main" | |
FOLDER: "docs/storybook-static" | |
CLEAN: true | |
TARGET_FOLDER: "docs" |