mirror of
https://github.com/containers/podman.git
synced 2025-05-20 00:27:03 +08:00
GHA: Validate release version number
There's a reasonable chance this workflow will be triggered by a human (via `workflow_dispatch``), and a non-zero chance with an invalid version number for which a release should not be created. Detect this and provide a way for the operator to debug the source of the error. Also fix some whitespace inconsistencies. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
23
.github/workflows/release-artifacts.yml
vendored
23
.github/workflows/release-artifacts.yml
vendored
@ -25,15 +25,34 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
# If the job fails, these details are all but impossible to observe.yy
|
||||
- name: Provide github event JSON for examination
|
||||
run: |
|
||||
echo "::group::Event JSON"
|
||||
jq --color-output "." ${{ github.event_path }}""
|
||||
echo "::endgroup::"
|
||||
- name: Determine Version
|
||||
id: getversion
|
||||
run: |
|
||||
if [[ -z "${{ inputs.version }}" ]]
|
||||
then
|
||||
VERSION=${{ github.event.release.tag_name }}
|
||||
VERSION=${{ github.event.release.tag_name }}
|
||||
else
|
||||
VERSION=${{ inputs.version }}
|
||||
VERSION=${{ inputs.version }}
|
||||
fi
|
||||
|
||||
if ! grep -Eq 'v[0-9]+(\.[0-9]+(\.[0-9]+(-.+)?)?)?$' <<<"$VERSION"
|
||||
then
|
||||
echo "Unable to parse release version '$VERSION' from github event JSON, or workflow 'version' input."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -Eq '.+-dev$' <<<"$VERSION"
|
||||
then
|
||||
echo "Refusing to process a "-dev" version '$VERSION'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
|
Reference in New Issue
Block a user