mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-24 22:25:02 +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
|
||||
id: get_version
|
||||
run: |
|
||||
if [[ "${{ inputs.version_file }}" == "" ]]; then
|
||||
VERSION=$(date '+%Y%m%d')
|
||||
elif [[ "${{ inputs.version_file }}" == */*.yaml ]]; then
|
||||
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
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
let version = '';
|
||||
|
||||
- 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
|
||||
run: |
|
||||
RELEASE=$(date '+%H%M%S')
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
let release = '';
|
||||
|
||||
echo "release=$RELEASE" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
if (${{ contains(fromJSON('["testing", "unstable"]') , steps.get_stability.outputs.stability) }} === true) {
|
||||
release = "1"
|
||||
} else {
|
||||
release = Date.now()
|
||||
}
|
||||
|
||||
core.setOutput('release', release);
|
||||
|
||||
- name: "Get release type: hotfix, release or not defined if not a release"
|
||||
id: get_release_type
|
||||
|
Loading…
x
Reference in New Issue
Block a user