GithubHelp home page GithubHelp logo

teambit / bit-with-github-actions Goto Github PK

View Code? Open in Web Editor NEW
12.0 6.0 16.0 1.23 MB

A Bit integration with GitHub Actions CI.

Home Page: https://bit.dev

HTML 12.69% CSS 9.41% JavaScript 77.91%
components ci design-system bit design-systems component-library component-architecture

bit-with-github-actions's Introduction

Bit with GitHub Actions

Build CI Bit export CI components Slack

How to integrate Bit in your workflow with GitHub Actions.

npm install for public or private Bit components during CI (for projects that install components)

For installing public components you need to config the bit registry. To do so create an .npmrc file in your project's root directory, and place the following code inside:

@bit:registry=https://node.bit.dev
always-auth=true

For installing private components, you need to save your BIT_TOKEN in the repository settings.

Follow these steps to do this:

  • Read how to create encrypted secrets for a repository.
  • Create a new secret and name it BIT_TOKEN and then set your Bit token in the value. To get your token, run bit config get user.token on your local terminal.
  • Update the .npmrc file to include the token registry:
@bit:registry=https://node.bit.dev
//node.bit.dev/:_authToken=${BIT_TOKEN}
always-auth=true

bit export during CI

  • Create your collection on bit.dev.
  • Import the compiler you need.
  • Import the tester you need.
  • Track, tag and export components to your collection, Alert component for example.
  • Create a new workflow file for bit export commands. Inside the file we need to do the following: configure Bit token, install Bit, run bit import, build&test, tag and export. Check out the workflows file I wrote about this, it will run when push to master are made(you can change/add branches it to your needs). Bit will tag components only if changes are made, and it will export and commit back to master the changes that are made to the .bitmap file.
  • The components will be exported to the default scope that we can configure in the Bit config object inside the package.json file.
    "bit": {
      ...
      "defaultScope": "<username/organization>.<collection>"
    }
    
  • When a new component is tracked locally, and then exported during the CI, Bit exports it to the default collection. (CI example)
  • When a component's test fails in the CI, it is not exported. (CI example)

Run Bit build & test on PR's

When someone in your team made a change to a component, you want to be sure that everything is working well before exporting a new version of it.
For this, I wrote another workflows file, and it will run when pull requests are made to master (you can change/add branches it to your needs). After all the checks have passed, you can merge it.
Now, the bit export workflows file will run automatically, and it will export and commit back to master the changes that are made to the .bitmap file.

Options

  • Skip CI: skip bit export workflow by entering skip-ci in the commit message.

bit-with-github-actions's People

Contributors

guysaar223 avatar jonisar avatar joshk2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bit-with-github-actions's Issues

How to specify fix, minor and major changes and tag messages for changelog?

Hi there!

I was wondering how to specify the nature of our changes on the components.

Using bit tag -a doesn't seem to ba a solution to this. In my company we are currently using Lerna with conventional commits.

Is conventional commits something you are planning to integrate to make the versioning process usable?

Registry error with subdirectory

Hi, I am trying to install my @bit public components on a project that is in a subfolder (frontend/) but I am getting the following error:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@mattborghi%2fsciquant.ui.github - Not found
npm ERR! 404 
npm ERR! 404  '@mattborghi/[email protected]' is not in the npm registry.

I tried moving the .npmrc file into the subfolder but the error persists. The yml file that I used is this one

name: Deploy to Github Pages
on: 
  push:
    branches: 
      - 'main'
jobs:
  Deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./frontend
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '14.x'
      - run: npm install
      - run: npm run deploy

I also tried setting this configuration without using the .npmrc file with no luck like this

- uses: actions/setup-node@v2
        with:
          always-auth: true
          node-version: '14.x'
          registry-url: https://node.bit.dev

I get another error in this case

npm WARN audit Audit result from registry missing metadata. This is probably an issue with the registry.
added 2060 packages from 1143 contributors in 49.193s

147 packages are looking for funding
  run `npm fund` for details

npm ERR! Cannot convert undefined or null to object

Does anyone have any idea why this might be happening? Thanks in advance, Matias.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.