mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-25 22:55:15 +02:00
refactor(release): align plugins release number to branch name in testing context (#5392)
Co-authored-by: Kevin Duret <kduret@centreon.com>
This commit is contained in:
parent
8ad485f423
commit
dfda070220
46
.github/workflows/get-environment.yml
vendored
46
.github/workflows/get-environment.yml
vendored
@ -246,24 +246,40 @@ jobs:
|
|||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
if [[ "${{ inputs.version_file }}" == "" ]]; then
|
with:
|
||||||
VERSION=$(date '+%Y%m%d')
|
script: |
|
||||||
elif [[ "${{ inputs.version_file }}" == */*.yaml ]]; then
|
let version = '';
|
||||||
VERSION=$(grep 'version: ' ${{ inputs.version_file }} | cut -d' ' -f2 | tr -d '"')
|
|
||||||
else
|
|
||||||
VERSION=$(grep VERSION ${{ inputs.version_file }} | cut -d "'" -f 2)
|
|
||||||
fi
|
|
||||||
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: "Get release: 1 for testing / stable, <date>.<commit_sha> for others"
|
if ('${{ steps.get_stability.outputs.stability }}' === 'testing') {
|
||||||
|
const branchName = "${{ github.ref_name }}";
|
||||||
|
const matches = branchName.match(/^(?:release|hotfix)-(\d{8})$/);
|
||||||
|
if (matches) {
|
||||||
|
version = matches[1];
|
||||||
|
} else {
|
||||||
|
throw new Error('invalid version');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const currentDate = new Date();
|
||||||
|
version = `${currentDate.getFullYear()}${("0" + (currentDate.getMonth() + 1)).slice(-2)}00`;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.setOutput('version', version);
|
||||||
|
|
||||||
|
- name: "Get release: 1 for testing / stable, <date> for others"
|
||||||
id: get_release
|
id: get_release
|
||||||
run: |
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
RELEASE=$(date '+%H%M%S')
|
with:
|
||||||
|
script: |
|
||||||
|
let release = '';
|
||||||
|
|
||||||
echo "release=$RELEASE" >> $GITHUB_OUTPUT
|
if (${{ contains(fromJSON('["testing", "unstable"]') , steps.get_stability.outputs.stability) }} === true) {
|
||||||
shell: bash
|
release = "1"
|
||||||
|
} else {
|
||||||
|
release = Date.now()
|
||||||
|
}
|
||||||
|
|
||||||
|
core.setOutput('release', release);
|
||||||
|
|
||||||
- name: "Get release type: hotfix, release or not defined if not a release"
|
- name: "Get release type: hotfix, release or not defined if not a release"
|
||||||
id: get_release_type
|
id: get_release_type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user