add make tag directives

This commit is contained in:
shah 2024-02-28 14:39:53 -08:00
parent af0d6a95c8
commit 80485821ff
2 changed files with 49 additions and 0 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
.PHONY: tag
MAX_COUNT ?= 1
tag:
@git add .
@git commit -m "Bump version to $(version)"
@git tag -a v$(version) -m "version $(version)"
@git push origin v$(version)
get_latest_tags:
@echo "Latest $(MAX_COUNT) tags:"
@echo $$(tput setaf 2) `git describe --tags $(git rev-list --tags --max-count=$(MAX_COUNT))` $$(tput sgr0)

View File

@ -40,6 +40,43 @@ packages:
revision: "v1.1.0"
```
---
**NOTE** Steps `2-5` above can also be automated using `make tag` directive:
### Tag Makefile Directives
#### `tag`
The `tag` directive is used to tag the current commit with a version number.
**Usage**:
```sh
make tag version=<version_number>
```
Replace <version_number> with the version number you want to use.
What it does:
Adds all changes to the staging area with `git add .`
Commits the changes with a commit message of `Bump version to <version_number>`.
Creates a new `git tag` with the name `v<version_number>` and a message of `version <version_number>`.
Pushes the new tag to the origin remote.
#### get_latest_tags
The get_latest_tags directive is used to display the latest git tags. By default, it displays the latest tag. You can change the number of tags displayed by setting the MAX_COUNT variable.
Usage:
```sh
make get_latest_tags MAX_COUNT=<count>
```
Replace <count> with the number of latest tags you want to display. If you don't specify a count, it defaults to `1`.
What it does:
Displays the latest `<count> git tags` in green text.
---
7. Run dbt deps in the other dbt project to pull the specific version of the package or follow the steps on `adding the dbt package` below.
Regarding Semantic Versioning;