File tree Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 1919 name : Build and publish
2020 runs-on : ubuntu-latest
2121 steps :
22- - uses : actions/checkout@v3
22+ - uses : actions/checkout@v4
23+ with :
24+ fetch-tags : true
2325
2426 - name : Echo Go Cache Paths
2527 id : go-cache-paths
@@ -44,11 +46,18 @@ jobs:
4446 username : ${{ github.actor }}
4547 password : ${{ secrets.GITHUB_TOKEN }}
4648
47- - name : Build and Push
49+ - name : Get version
50+ id : get-version
51+ env :
52+ ENVBUILDER_RELEASE : " t"
4853 run : |
49- VERSION=$(./scripts/version.sh)
50- BASE=ghcr.io/coder/envbuilder
54+ echo "ENVBUILDER_VERSION=$(./scripts.version.sh)" >> $GITHUB_OUTPUT
5155
56+ - name : Build and Push
57+ env :
58+ VERSION : " ${{ steps.get-version.outputs.ENVBUILDER_VERSION }}"
59+ BASE : " ghcr.io/coder/envbuilder"
60+ run : |
5261 ./scripts/build.sh \
5362 --arch=amd64 \
5463 --arch=arm64 \
Original file line number Diff line number Diff line change @@ -39,3 +39,9 @@ cdroot() {
3939log () {
4040 echo " $* " 1>&2
4141}
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
5454 # $last_tag will equal `git describe --always` if we currently have the tag
5555 # checked out.
5656 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-
6457 error " version.sh: the current commit is not tagged with an annotated tag"
6558 fi
6659else
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} "
6962 # If the git repo has uncommitted changes, mark the version string as 'dirty'.
7063 dirty_files=$( git ls-files --other --modified --exclude-standard)
7164 if [[ -n " ${dirty_files} " ]]; then
7265 version+=" -dirty"
7366 fi
7467fi
7568
76-
7769# Remove the "v" prefix.
7870echo " ${version# v} "
You can’t perform that action at this time.
0 commit comments