File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ echo " Fetching latest Bookstack release from GitHub API"
4+
35BOOKSTACK_VERSION=$( curl -L \
46 -H " Accept: application/vnd.github+json" \
57 -H " X-GitHub-Api-Version: 2022-11-28" \
68 https://api.github.com/repos/BookstackApp/Bookstack/releases/latest | \
79 jq -r .tag_name
810)
911
10- echo " Latest: ${BOOKSTACK_VERSION} . Updating.."
12+ echo " Found latest version: ${BOOKSTACK_VERSION} "
13+
14+ # Get the root of the Git repository in order to correctly path e.g. Dockerfile
15+ GIT_ROOT=$( git rev-parse --show-toplevel)
1116
17+ echo " Updating Dockerfile.."
1218sed \
1319 -i ' ' \
1420 -e " s/^ENV BOOKSTACK_VERSION=.*/ENV BOOKSTACK_VERSION=${BOOKSTACK_VERSION} /" \
15- Dockerfile
21+ " ${GIT_ROOT} /Dockerfile"
22+
23+ git add " ${GIT_ROOT} /Dockerfile"
24+ git commit -S -m " feat: update Dockerfile to use Bookstack ${BOOKSTACK_VERSION} "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Get the root of the Git repository in order to correctly path e.g. Dockerfile
4+ GIT_ROOT=$( git rev-parse --show-toplevel)
5+
6+ # Extract the version from the Dockerfile, as there could have been a new
7+ # release since the last run.
8+
9+ BOOKSTACK_VERSION=$( awk \
10+ ' /ENV BOOKSTACK_VERSION/{split($2,b,"="); print b[2]}' \
11+ " ${GIT_ROOT} /Dockerfile"
12+ )
13+
14+ echo " Extracted version: ${BOOKSTACK_VERSION} "
15+
16+ # Remove the 'v' for our tags
17+ BOOKSTACK_VERSION=" ${BOOKSTACK_VERSION/# v/ } "
18+ # Remove leading zeros to make the version fit a SemVer-shaped hole
19+ BOOKSTACK_VERSION=" ${BOOKSTACK_VERSION/ .0/ .} "
20+ # And again for patch version, just in case
21+ BOOKSTACK_VERSION=" ${BOOKSTACK_VERSION/ .0/ .} "
22+
23+ echo " Tag name: ${BOOKSTACK_VERSION} "
24+
25+ git tag -s -a " ${BOOKSTACK_VERSION} " -m " Release version ${BOOKSTACK_VERSION} "
26+ git push --tags
27+
28+ # TODO: Sort VERSION file
29+ # TODO: Update README version
30+ # TODO: Update docker-compose
You can’t perform that action at this time.
0 commit comments