change get_release step language to js

This commit is contained in:
Paul Oureib 2025-01-14 17:59:21 +01:00
parent d53734557e
commit 06c620c12d

View File

@ -249,18 +249,24 @@ jobs:
- name: "Get release: 1 for testing / stable, <date>.<commit_sha> for others"
id: get_release
run: |
if [[ ${{ steps.get_stability.outputs.stability }} == "testing" || ${{ steps.get_stability.outputs.stability }} == "stable" ]]; then
RELEASE=$(echo ${{ github.ref_name }} | cut -d "-" -f2)-1
if [[ $(#RELEASE) != 10 || ${RELEASE::2} != 20 || ! ${RELEASE:4: -4} =~ ^0[1-9]$|1[0-2]$ ]]; then
echo "invalid release name"
exit 1
fi
else
RELEASE=$(date '+%H%M%S')
fi
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
let release = '';
echo "release=$RELEASE" >> $GITHUB_OUTPUT
if (${{ steps.get_stability.outputs.stability }} === 'testing') {
const branchName = "${{ github.ref_name }}";
const matches = branchName.match(/^(?:release|hotfix)-(\d{8})$/);
if (matches) {
release = matches[1];
} else {
throw new Error('invalid release name');
}
} else {
release = new Date().toLocaleTimeString('en-US', { hour12: false }).replaceAll(":","")
}
core.setOutput('release', release);
shell: bash
- name: "Get release type: hotfix, release or not defined if not a release"