mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 05:04:05 -08:00
add scripts/get_module_version.sh
This script consumes a Prometheus version (or version tag) and prints the appropriate module version. Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
This commit is contained in:
parent
76999c1dcb
commit
0f79e5e289
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -253,7 +253,7 @@ jobs:
|
|||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.'))
|
||||
||
|
||||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v3.'))
|
||||
run: ./scripts/ui_release.sh --check-package "$(echo ${{ github.ref_name }}|sed s/v2/v0/)"
|
||||
run: ./scripts/ui_release.sh --check-package "$(./scripts/get_module_version.sh ${{ github.ref_name }})"
|
||||
- name: build
|
||||
run: make assets
|
||||
- name: Copy files before publishing libs
|
||||
|
|
|
@ -187,7 +187,7 @@ the Prometheus server, we use major version zero releases for the libraries.
|
|||
Tag the new library release via the following commands:
|
||||
|
||||
```bash
|
||||
tag="v$(sed s/2/0/ < VERSION)"
|
||||
tag="v$(./scripts/get_module_version.sh)"
|
||||
git tag -s "${tag}" -m "${tag}"
|
||||
git push origin "${tag}"
|
||||
```
|
||||
|
|
24
scripts/get_module_version.sh
Executable file
24
scripts/get_module_version.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# if no version string is passed as an argument, read VERSION file
|
||||
if [ $# -eq 0 ]; then
|
||||
VERSION="$(< VERSION)"
|
||||
else
|
||||
VERSION=$1
|
||||
fi
|
||||
|
||||
|
||||
# Remove leading 'v' if present
|
||||
VERSION="${VERSION#v}"
|
||||
|
||||
# Extract MAJOR, MINOR, and REST
|
||||
MAJOR="${VERSION%%.*}"
|
||||
MINOR="${VERSION#*.}"; MINOR="${MINOR%%.*}"
|
||||
REST="${VERSION#*.*.}"
|
||||
|
||||
# Format and output based on MAJOR version
|
||||
if [[ "$MAJOR" == "2" ]]; then
|
||||
echo "0.$MINOR.$REST"
|
||||
elif [[ "$MAJOR" == "3" ]]; then
|
||||
printf "0.3%02d.$REST\n" "$MINOR"
|
||||
fi
|
Loading…
Reference in a new issue