Skip to content

Commit 31d55d7

Browse files
committed
feat: start adding tags with new versions
1 parent c37d6b8 commit 31d55d7

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

scripts/update_dockerfile.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
#!/usr/bin/env bash
22

3+
echo "Fetching latest Bookstack release from GitHub API"
4+
35
BOOKSTACK_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.."
1218
sed \
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}"

scripts/update_tags_and_docs.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)