3.9.1 • Published 4 years ago

@charliec3/gh-actions-example-docs2 v3.9.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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
3.9.1

4 years ago

3.9.0

4 years ago

1.0.0

4 years ago