Skip to content

Commit 7f6ccc9

Browse files
committed
Makefile: add tag_release target for bumping version and tagging
Signed-off-by: Elias Naur <[email protected]>
1 parent 99d00e8 commit 7f6ccc9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,30 @@ TAILSCALE_COMMIT=$(lastword $(subst -g, ,$(TAILSCALE_VERSION)))
1313
GIT_DESCRIBE=$(shell git describe --dirty --exclude "*" --always --abbrev=200)
1414
VERSION_LONG=$(shell ./version/mkversion.sh long $(TAILSCALE_VERSION) $(GIT_DESCRIBE))
1515
VERSION_SHORT=$(shell ./version/mkversion.sh short $(TAILSCALE_VERSION) $(GIT_DESCRIBE))
16+
VERSIONCODE=$(lastword $(shell grep versionCode android/build.gradle))
17+
VERSIONCODE_PLUSONE=$(shell expr $(VERSIONCODE) + 1)
1618

1719
all: $(APK)
1820

21+
tag_release:
22+
sed -i 's/versionCode [[:digit:]]\+/versionCode $(VERSIONCODE_PLUSONE)/' android/build.gradle
23+
sed -i 's/versionName .*/versionName "$(VERSION_LONG)"/' android/build.gradle
24+
git commit -sm "android: bump version code" android/build.gradle
25+
git tag -a "v$(VERSION_LONG)"
26+
1927
$(DEBUG_APK):
2028
mkdir -p android/libs
2129
go run gioui.org/cmd/gogio -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale
2230
(cd android && ./gradlew assemblePlayDebug)
2331
mv android/build/outputs/apk/play/debug/android-play-debug.apk $@
2432

33+
# This target is also used by the F-Droid metadata.
2534
release_aar:
2635
mkdir -p android/libs
2736
go run gioui.org/cmd/gogio -ldflags "-X tailscale.com/version.Long=$(VERSION_LONG) -X tailscale.com/version.Short=$(VERSION_SHORT) -X tailscale.com/version.GitCommit=$(TAILSCALE_COMMIT)" -tags xversion -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale
2837

2938
$(RELEASE_AAB): release_aar
30-
(cd android && VERSION=$(VERSION_LONG) ./gradlew bundlePlayRelease)
39+
(cd android && ./gradlew bundlePlayRelease)
3140
mv ./android/build/outputs/bundle/playRelease/android-play-release.aab $@
3241

3342
release: $(RELEASE_AAB)
@@ -43,4 +52,4 @@ dockershell:
4352
clean:
4453
rm -rf android/build $(RELEASE_AAB) $(DEBUG_APK) $(AAR)
4554

46-
.PHONY: all clean install $(DEBUG_APK) $(RELEASE_AAB) release_aar release dockershell
55+
.PHONY: all clean install $(DEBUG_APK) $(RELEASE_AAB) release_aar release bump_version dockershell

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ $ make dockershell
3131
# make tailscale-debug.apk
3232
```
3333

34+
Use `make tag_release` to bump the Android version code, update the version
35+
name, and tag the current commit.
36+
3437
We only guarantee to support the latest Go release and any Go beta or
3538
release candidate builds (currently Go 1.14) in module mode. It might
3639
work in earlier Go versions or in GOPATH mode, but we're making no

0 commit comments

Comments
 (0)