File tree 3 files changed +21
-14
lines changed
3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 19
19
name : Build and publish
20
20
runs-on : ubuntu-latest
21
21
steps :
22
- - uses : actions/checkout@v3
22
+ - uses : actions/checkout@v4
23
+ with :
24
+ fetch-tags : true
23
25
24
26
- name : Echo Go Cache Paths
25
27
id : go-cache-paths
@@ -44,11 +46,18 @@ jobs:
44
46
username : ${{ github.actor }}
45
47
password : ${{ secrets.GITHUB_TOKEN }}
46
48
47
- - name : Build and Push
49
+ - name : Get version
50
+ id : get-version
51
+ env :
52
+ ENVBUILDER_RELEASE : " t"
48
53
run : |
49
- VERSION=$(./scripts/version.sh)
50
- BASE=ghcr.io/coder/envbuilder
54
+ echo "ENVBUILDER_VERSION=$(./scripts.version.sh)" >> $GITHUB_OUTPUT
51
55
56
+ - name : Build and Push
57
+ env :
58
+ VERSION : " ${{ steps.get-version.outputs.ENVBUILDER_VERSION }}"
59
+ BASE : " ghcr.io/coder/envbuilder"
60
+ run : |
52
61
./scripts/build.sh \
53
62
--arch=amd64 \
54
63
--arch=arm64 \
Original file line number Diff line number Diff line change @@ -39,3 +39,9 @@ cdroot() {
39
39
log () {
40
40
echo " $* " 1>&2
41
41
}
42
+
43
+ # error prints an error message and returns an error exit code.
44
+ error () {
45
+ log " ERROR: $* "
46
+ exit 1
47
+ }
Original file line number Diff line number Diff line change @@ -54,25 +54,17 @@ if [[ "${ENVBUILDER_RELEASE:-}" == *t* ]]; then
54
54
# $last_tag will equal `git describe --always` if we currently have the tag
55
55
# checked out.
56
56
if [[ " ${last_tag} " != " $( git describe --always) " ]]; then
57
- # make won't exit on $(shell cmd) failures, so we have to kill it :(
58
- if [[ " $( ps -o comm= " ${PPID} " || true) " == * make* ]]; then
59
- log " ERROR: version.sh: the current commit is not tagged with an annotated tag"
60
- kill " ${PPID} " || true
61
- exit 1
62
- fi
63
-
64
57
error " version.sh: the current commit is not tagged with an annotated tag"
65
58
fi
66
59
else
67
- rev=$( git rev-parse --short HEAD)
68
- version= " 0.0.0 +dev-${rev} "
60
+ rev=$( git log -1 --format= ' %h ' HEAD)
61
+ version+= " +dev-${rev} "
69
62
# If the git repo has uncommitted changes, mark the version string as 'dirty'.
70
63
dirty_files=$( git ls-files --other --modified --exclude-standard)
71
64
if [[ -n " ${dirty_files} " ]]; then
72
65
version+=" -dirty"
73
66
fi
74
67
fi
75
68
76
-
77
69
# Remove the "v" prefix.
78
70
echo " ${version# v} "
You can’t perform that action at this time.
0 commit comments