Giter Club home page Giter Club logo

gh-actions-example's Introduction

gh-actions-example

This repository serves as an example on:

  • How to configure a workflow which notifies Slack, builds and publishes a Docker image, and automatically versions the repo
  • How to configure semantic versioning using semantic-release, commitlint, and husky

How to Use This Repository

This repository can be used to experiment with the automated semantic versioning and get familiar with it. The repository MUST be returned back to a working state once done testing.

  1. Install dependencies
    # If you use yarn
    yarn install
    
    # If you use npm
    npm install
  2. Make a minor change and commit it to this repo with a message which follows the Angular Commit Message Convention. The commit message and TYPE can be whatever you'd like. Push to master when done.
  3. View the running action here.
  4. Join the #devops-notify channel to observe the Slack notification(s).
  5. Generated release notes can be found here and here.

Configure a Repo with Automatic Semantic Versioning

In order to configure a Git repo with automatic semantic versioning, follow the steps below:

  1. Clone the project
  2. Create a package.json file
  3. Copy the commitlint, husky, and release configurations found in the example package.json to the package.json in your project.
  4. Run the following to install the commitlint and husky packages locally and save them as development dependencies to the package.json
    • Only commitlint and husky need to be installed locally, semantic-release does not since it'll only be used by Github Actions.
    • Upon installation of husky, it will attempt to create a pre-commit hook in your git repo
    • If you see errors, resolve them then try re-installing.
    # If you use yarn
    yarn add --dev husky @commitlint/{config-conventional,cli} --force
    
    # If you use npm
    npm install --save-dev husky @commitlint/{config-conventional,cli}
  5. Add the following files/dirs to the .gitignore file (unless you want to commit any of them):
    echo -e "node_modules\npackage-lock.json\nyarnlock" >> .gitignore
  6. Add a Github Actions workflow to .github/workflows/
  7. Commit all new files/modifications (except for anything being ignored)
    • Upon commit, you should see a pre-commit hook fire which runs commitlint and checks your commit message. Your message must conform to the Angular Commit Message Convention, otherwise it will be denied by commitlint. If this does not happen or an error occurs, try resolving the error then try again.

Going forward, anyone who wishes to commit to your repository will need to run the following command beforehand to install local dev dependencies. It should be quick and only take a few seconds:

    # If you use yarn
    yarn install

    # If you use npm
    npm install

gh-actions-example's People

Contributors

blockstack-devops avatar charliec3 avatar semantic-release-bot avatar

Watchers

 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.