File tree 2 files changed +41
-2
lines changed
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ echo " Fetching latest Bookstack release from GitHub API"
4
+
3
5
BOOKSTACK_VERSION=$( curl -L \
4
6
-H " Accept: application/vnd.github+json" \
5
7
-H " X-GitHub-Api-Version: 2022-11-28" \
6
8
https://api.github.com/repos/BookstackApp/Bookstack/releases/latest | \
7
9
jq -r .tag_name
8
10
)
9
11
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)
11
16
17
+ echo " Updating Dockerfile.."
12
18
sed \
13
19
-i ' ' \
14
20
-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