Skip to content

Commit 32571aa

Browse files
committed
Move version check to separate bash script
1 parent c87702f commit 32571aa

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# assumes $INPUT_VERSION is set to the selected release version
2+
CURRENT_VERSION=$(echo "$(cat DESCRIPTION)" | grep "Version:" | awk '{print $2}')
3+
4+
if [ "$(printf '%s\n' "$INPUT_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$INPUT_VERSION" ]; then
5+
echo "::error title=Invalid version::Provided version number must be higher than the current version ($CURRENT_VERSION)."
6+
exit 1
7+
fi

.github/workflows/release.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
name: release
3-
run-name: Release usmap ${{ inputs.version }}
3+
run-name: Release ${{ github.event.repository.name }} ${{ inputs.version }}
44

55
on:
66
workflow_dispatch:
@@ -21,13 +21,7 @@ jobs:
2121
- name: Check version number
2222
env:
2323
INPUT_VERSION: ${{ inputs.version }}
24-
run: |
25-
CURRENT_VERSION=$(echo "$(cat DESCRIPTION)" | grep "Version:" | awk '{print $2}')
26-
27-
if [ "$(printf '%s\n' "$INPUT_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$INPUT_VERSION" ]; then
28-
echo "::error title=Invalid version::Provided version number must be higher than the current version ($CURRENT_VERSION)."
29-
exit 1
30-
fi
24+
run: .github/workflow-resources/release-version-check.sh
3125

3226
- name: Setup R
3327
uses: r-lib/actions/setup-r@v2
@@ -58,7 +52,7 @@ jobs:
5852
uses: jacobtomlinson/gha-find-replace@v3
5953
with:
6054
find: "[unreleased]"
61-
replace: "usmap ${{ inputs.version }}"
55+
replace: "${{ github.event.repository.name }} ${{ inputs.version }}"
6256
include: "NEWS.md"
6357
regex: false
6458

0 commit comments

Comments
 (0)