Skip to content

teambit/bit-with-github-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 just need to config the bit registry, to do so create in your project root directory an .npmrc file and put the following code inside:

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

For installing private components, we need to save our BIT_TOKEN in the repository settings. Follow these setups to do this:

@bit:registry=https://node.bit.dev
//node.bit.dev/:_authToken=${BIT_TOKEN}
always-auth=true

bit export during during CI

  • Create your collection in 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 export during the CI, Bit exports it to the default collection. (CI example)
  • When a component 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 has passed, you can merge it, and what happens 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.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •