Skip to content

Commit

Permalink
docs: update circleci ci-setup.md (#3989)
Browse files Browse the repository at this point in the history
* Update cirlcleci ci-setup.md

The syntax of the circleci config.yml was out of date.

* style: prettier

---------

Co-authored-by: user <user@deeppink.lan>
  • Loading branch information
HennaAbbas and user committed Apr 8, 2024
1 parent ce8180f commit 398be5a
Showing 1 changed file with 39 additions and 35 deletions.
74 changes: 39 additions & 35 deletions docs/guides/ci-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,52 +70,56 @@ script:
It's just a simple example of how CircleCI configuration file could look like to validate last commit message

```yml
version: 2
defaults:
working_directory: ~/project
docker:
- image: circleci/node:latest
version: 2.1

executors:
my-executor:
docker:
- image: cimg/node:current
working_directory: ~/project

jobs:
setup:
<<: *defaults
executor: my-executor
steps:
- checkout
- restore_cache:
key: lock-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: lock-{{ checksum "package-lock.json" }}
paths:
- node_modules
- persist_to_workspace:
root: ~/project
paths:
- node_modules
- checkout
- restore_cache:
key: lock-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: lock-{{ checksum "package-lock.json" }}
paths:
- node_modules
- persist_to_workspace:
root: ~/project
paths:
- node_modules

lint_commit_message:
<<: *defaults
executor: my-executor
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: Define environment variable with latest commit's message
command: |
echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV
source $BASH_ENV
- run:
name: Lint commit message
command: echo "$COMMIT_MESSAGE" | npx commitlint
- checkout
- attach_workspace:
at: ~/project
- run:
name: Define environment variable with latest commit's message
command: |
echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV
source $BASH_ENV
- run:
name: Lint commit message
command: echo "$COMMIT_MESSAGE" | npx commitlint

workflows:
version: 2
version: 2.1
commit:
jobs:
- setup
- lint_commit_message: { requires: [setup] }
- setup
- lint_commit_message:
requires:
- setup
```

## GitLab CI
Expand Down

0 comments on commit 398be5a

Please sign in to comment.