Git Product home page Git Product logo

bit-init-action's Introduction

Initialize Bit for CI/CD Pipelines

Initialize Bit for CI/CD Pipelines

GitHub Actions

This task installs Bit in your CI by executing bit install inside the workspace directory.

Inputs

ws-dir

Optional The workspace directory path from the root. Default "./".

Example usage

  1. Create a new secret variable BIT_CONFIG_USER_TOKEN and use it as an environment variable in your GitHub Action.
  2. [Optional] Create new secret variables GIT_USER_NAME, GIT_USER_EMAIL and use them as environment variables in your GitHub Action.
  3. [Optional] Define GITHUB_TOKEN also as an environment variable. Here, GITHUB_TOKEN secret is automatically created by GitHub Actions.
  4. [Optional] If your workspace is not at the root of the Git repository, specify the input parameter ws-dir pointing to the workspace directory path.

Note: GITHUB_TOKEN, GIT_USER_NAME, and GIT_USER_EMAIL are required for tasks like bit-tasks/commit-bitmap@v1, bit-tasks/dependency-update@v1 etc. Therefore, it is recommended to define these variables upfront, which makes the workflow configuration consistent and reusable across different bit-tasks.

name: Test Bit Init
on:
  workflow_dispatch:
jobs:
  install:
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
      GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
      BIT_CONFIG_USER_TOKEN: ${{ secrets.BIT_CONFIG_USER_TOKEN }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Initialize Bit
        uses: bit-tasks/init@v1
        with:
          ws-dir: '<WORKSPACE_DIR_PATH>'

Resolve component packages

Use the below step to resolve component packages from bit.cloud registry.

      - name: Resolve component packages from bit.cloud registry (Mandatory for component installation using package managers other than Bit)
        run: |
          npm config set '@bit:registry' https://node-registry.bit.cloud
          npm config set '@teambit:registry' https://node-registry.bit.cloud
          npm config set //node-registry.bit.cloud/:_authToken ${{ env.BIT_CONFIG_USER_TOKEN }}

Note: For external registries, append a new configuration to the registry config list and configure the authToken if required.

  npm config set`@myorg:registry` https://<my-org-registry-url>
  npm config set //<my-org-registry-url>/:_authToken ${{ <MY ORG ACCESS TOKEN> }}

Contributor Guide

Steps to create custom tasks in different CI/CD platforms.

GitHub Actions

Go to the GithHub action task directory and build using NCC compiler. For example;

npm install
npm run build
git commit -m "Update task"
git tag -a -m "action release" v1 --force
git push --follow-tags

For more information, refer to Create a javascript action

bit-init-action's People

Contributors

ashanfernando avatar welingtonsampaio avatar github-actions[bot] avatar

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.