Skip to content

Commit 74f04e9

Browse files
authored
Merge commit from fork
[skip-ci] Tighten version match
2 parents c0b352f + d7fefb7 commit 74f04e9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/machine-os-pr.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ jobs:
2727
- name: Get version
2828
id: getversion
2929
run: |
30-
VERSION=$(curl "https://raw.githubusercontent.com/$PODMAN_REPO/$SHA/version/rawversion/version.go" | sed -n 's/^const RawVersion = \"\(.*\)\"$/\1/p')
30+
VERSION=$(curl "https://raw.githubusercontent.com/$PODMAN_REPO/$SHA/version/rawversion/version.go" | sed -n 's/^const RawVersion = \"\([0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\|-dev\)\?\)"$/\1/p')
3131
# ignore -dev version bumps unless on main
32-
if [[ $VERSION == *-dev ]] ; then
32+
if [[ -z "$VERSION" ]] ; then
33+
echo "::error:: Invalid version string"
34+
exit 1
35+
elif [[ $VERSION == *-dev ]] ; then
3336
echo "::warning:: SKIPPING: dev bump"
3437
elif [[ ${{github.base_ref}} == "main" ]] ; then
3538
echo "::warning:: SKIPPING: main branch"
@@ -72,9 +75,11 @@ jobs:
7275

7376
- name: Bump version
7477
if: steps.getversion.outputs.update == 'true'
78+
env:
79+
VERS: ${{steps.getversion.outputs.version}}
7580
run: |
76-
echo ${{steps.getversion.outputs.version}}
77-
sed -i 's/export PODMAN_VERSION=".*"/export PODMAN_VERSION="${{steps.getversion.outputs.version}}"/g' podman-rpm-info-vars.sh
81+
update=$(printf 's/export PODMAN_VERSION=".*"/export PODMAN_VERSION="%s"/g\n' "$VERS")
82+
sed -i "$update" podman-rpm-info-vars.sh
7883
sed -i 's/export PODMAN_PR_NUM=".*"/export PODMAN_PR_NUM="${{github.event.number}}"/g' podman-rpm-info-vars.sh
7984
echo "Updated file:"
8085
cat podman-rpm-info-vars.sh

0 commit comments

Comments
 (0)