Skip to content

Commit db4701d

Browse files
committedSep 19, 2021
Add a setgitversion script to update the version string with git
1 parent e7df718 commit db4701d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed
 

‎.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ jobs:
1616
1717
- name: Checkout repository
1818
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Package Source
2123
run: |
24+
./setgitversion
2225
mkdir source
2326
cabal sdist
2427
mv dist-newstyle/sdist/*.tar.gz source/source.tar.gz

‎setgitversion

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh -xe
2+
# This script hardcodes the `git describe` version as ShellCheck's version number.
3+
# This is done to allow shellcheck --version to differ from the cabal version when
4+
# building git snapshots.
5+
6+
file="src/ShellCheck/Data.hs"
7+
test -e "$file"
8+
tmp=$(mktemp)
9+
version=$(git describe)
10+
sed -e "s/=.*VERSIONSTRING.*/= \"$version\" -- VERSIONSTRING, DO NOT SUBMIT/" "$file" > "$tmp"
11+
mv "$tmp" "$file"

‎src/ShellCheck/Data.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ShellCheck.Interface
44
import Data.Version (showVersion)
55
import Paths_ShellCheck (version)
66

7-
shellcheckVersion = showVersion version
7+
shellcheckVersion = showVersion version -- VERSIONSTRING
88

99
internalVariables = [
1010
-- Generic

0 commit comments

Comments
 (0)