File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 appGitRefs :
77 required : true
88 type : string
9+ appAddSha :
10+ required : false
11+ type : boolean
12+ default : false
913 imgBuild :
1014 required : true
1115 type : string
7175 VERSION_PHP=${{ vars.VERSION_PHP }}
7276 VERSION_COMPOSER=${{ vars.VERSION_COMPOSER }}
7377 APP_GH_REF=${{ inputs.appGitRefs }}
78+ APP_GH_ADD_SHA=${{ inputs.appAddSha }}
7479 tags : ${{ steps.set_meta.outputs.tags }}
7580 push : true
Original file line number Diff line number Diff line change 66 workflow_dispatch :
77
88jobs :
9- build-develop :
10- uses : ./.github/workflows/build_and_publish.yml
11- with :
12- appGitRefs : develop
13- imgBuild : ${{ vars.IMAGE_BUILD }}
14- regName : ${{ vars.REGISTRY_URL }}
15- regLogin : ${{ vars.REGISTRY_LOGIN }}
9+ build-develop :
10+ uses : ./.github/workflows/build_and_publish.yml
11+ with :
12+ appGitRefs : develop
13+ appAddSha : true
14+ imgBuild : ${{ vars.IMAGE_BUILD }}
15+ regName : ${{ vars.REGISTRY_URL }}
16+ regLogin : ${{ vars.REGISTRY_LOGIN }}
1617 secrets :
1718 REGISTRY_TOKEN : ${{ secrets.REGISTRY_TOKEN }}
Original file line number Diff line number Diff line change @@ -36,14 +36,20 @@ This is the easiest and fastest way.
3636 APP_RELEASE=develop
3737 if [ " ${APP_RELEASE} " == " develop" ]; then
3838 APP_GH_REF=" refs/heads/${APP_RELEASE} "
39+ APP_GH_ADD_SHA=true
3940 else
4041 APP_GH_REF=" refs/tags/${APP_RELEASE} "
42+ APP_GH_ADD_SHA=false
4143 fi
4244
4345 # Build the docker image
4446 docker buildx build \
4547 --build-arg APP_GH_REF=${APP_GH_REF} \
48+ --build-arg APP_GH_ADD_SHA=${APP_GH_ADD_SHA} \
4649 --tag librebooking/librebooking:$( echo ${APP_RELEASE} | sed -e " s/^v//" ) \
4750 --output type=docker \
4851 .
4952 ```
53+
54+ When ` APP_GH_ADD_SHA=true ` , the web UI footer appends the LibreBooking app
55+ short SHA to the displayed version string.
Original file line number Diff line number Diff line change @@ -72,13 +72,36 @@ EORUN
7272
7373# Get and customize librebooking
7474ARG APP_GH_REF
75+ ARG APP_GH_ADD_SHA=false
7576RUN <<EORUN
7677set -xeuo pipefail
78+ LB_TARBALL_URL="https://api.github.com/repos/LibreBooking/librebooking/tarball/${APP_GH_REF}"
7779curl \
7880 --fail \
7981 --silent \
80- --location https://api.github.com/repos/librebooking/librebooking/tarball/${APP_GH_REF } \
82+ --location ${LB_TARBALL_URL } \
8183| tar --extract --gzip --directory=/var/www/html --strip-components=1
84+ if [ "${APP_GH_ADD_SHA}" = "true" ]; then
85+ LB_SHORT_SHA=""
86+ # TARBALL_FILENAME will be like the result of a `git describe` For
87+ # example: 'LibreBooking-librebooking-v4.1.0-126-g6cc8a4c.tar.gz' where
88+ # 'g6cc8a4c' is the short SHA prefixed with 'g'. So the short SHA is
89+ # '6cc8a4c'
90+ TARBALL_FILENAME=$(\
91+ curl \
92+ --head \
93+ --fail \
94+ --silent \
95+ --show-error \
96+ --location ${LB_TARBALL_URL} \
97+ | sed -nE 's/.*filename="?([^";]+)"?.*/\1 /p' )
98+ LB_SHORT_SHA=$(echo $TARBALL_FILENAME | sed -E 's/.*-g([0-9a-f]+)\. tar\. gz/\1 /' )
99+ if [ -n "${LB_SHORT_SHA}" ]; then
100+ printf '%s\n ' "${LB_SHORT_SHA}" > /var/www/html/config/version-suffix.txt
101+ else
102+ echo ERROR determining the LB_SHORT_SHA value
103+ fi
104+ fi
82105if [ -f /var/www/html/composer.json ]; then
83106 sed \
84107 -i /var/www/html/composer.json \
You can’t perform that action at this time.
0 commit comments