Skip to content

Commit 89be6a1

Browse files
committed
ci: fixed common ancestor & find tag commands
1 parent 23ea6a7 commit 89be6a1

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

.gitlab-ci.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,30 @@ linting:
3737

3838
conventional-commits-linting:
3939
stage: conventional-commits-linting
40-
image: node
40+
image: rust
4141
before_script:
42-
- npm install -g @commitlint/cli @commitlint/config-conventional
42+
- cargo install conventional_commits_linter
4343
script:
44-
- BRANCH_FIRST_COMMIT=`git log --pretty=tformat:"%H" origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME --not origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | tail -1`
44+
- COMMON_ANCESTOR_COMMIT=`git merge-base origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME`
4545
# Lint all the commits in the branch.
46-
- commitlint --from=$BRANCH_FIRST_COMMIT
46+
- /usr/local/cargo/bin/conventional_commits_linter --from-commit-hash $COMMON_ANCESTOR_COMMIT
4747
rules:
4848
- if: $CI_MERGE_REQUEST_ID
4949

5050

5151
conventional-commits-next-version-checking:
5252
stage: conventional-commits-next-version-checking
53-
image: archlinux/base
53+
image: rust
5454
before_script:
55-
- pacman -Syu --noconfirm
56-
- pacman -S diffutils unzip nettle wget git --noconfirm
55+
- cargo install conventional_commits_next_version
5756
script:
5857
# Get current version and latest tag.
5958
- CURRENT_VERSION=`grep '^version = "[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*"$' Cargo.toml | cut -d '"' -f 2`
60-
- LATEST_TAG=`git tag -l | sort -r | head -1`
59+
# If the latest tag is not a semantic version then conventional_commits_next_version will fail.
60+
- LATEST_TAG=`git describe --tags | cut -d '-' -f 1`
6161
- LATEST_TAG_HASH=`git rev-parse $LATEST_TAG`
62-
# Download conventional_commits_next_version binary.
63-
- wget https://gitlab.com/DeveloperC/conventional_commits_next_version/-/jobs/artifacts/1.1.0/download?job=building-release-binary-linux-musl
64-
- unzip download\?job=building-release-binary-linux-musl
6562
# Check current vs expected.
66-
- ./conventional_commits_next_version --batch-commits --from-commit-hash $LATEST_TAG_HASH --from-version $LATEST_TAG --current-version $CURRENT_VERSION
63+
- /usr/local/cargo/bin/conventional_commits_next_version --batch-commits --from-commit-hash $LATEST_TAG_HASH --from-version $LATEST_TAG --current-version $CURRENT_VERSION
6764
rules:
6865
- if: $CI_MERGE_REQUEST_ID
6966

commitlint.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)