Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-update changes #1090

Merged
merged 8 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,14 @@ jobs:
env:
VERSION: "${{ env.version }}"
DMG: "${{ env.prefix }}-${{ env.version }}.dmg"
update: "lantern_update_darwin-${{inputs.version}}.bz2"
update_source: lantern_update_darwin.bz2
run: |
mv ${{ env.update_source }} ${{ env.update }}
mv lantern-installer.dmg "$DMG"
cp "$DMG" ${{ env.prefix }}.dmg
echo ${{ env.version }} > ${{ env.version_file }}
shasum -a 256 "$DMG" | cut -d " " -f 1 > "$DMG".sha256
shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
cp "$DMG".sha256 ${{ env.prefix }}.dmg.sha256
s3cmd put --acl-public "$DMG" ${{ env.version_file }} "$DMG".sha256 ${{ env.prefix }}.dmg.sha256 ${{ env.prefix }}.dmg "s3://lantern"
s3cmd put --acl-public "$DMG" "$DMG".sha256 ${{ env.update }} ${{ env.update }}.sha256 ${{ env.version_file }} ${{ env.prefix }}.dmg.sha256 ${{ env.prefix }}.dmg "s3://lantern"
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,21 @@ jobs:
VERSION: "${{ env.version }}"
APK: "${{ env.prefix }}-${{ env.version }}.apk"
AAB: "${{ env.prefix }}-${{ env.version }}.aab"
update: "lantern_update_android_arm-${{inputs.version}}.bz2"
update_source: lantern_update_android_arm.bz2
run: |
mv ${{ env.update_source }} ${{ env.update }}
mv lantern-installer.apk "$APK"
mv lantern-installer.aab "$AAB"
cp "$APK" ${{ env.prefix }}.apk
cp "$AAB" ${{ env.prefix }}.aab
echo ${{ env.version }} > ${{ env.version_file }}
shasum -a 256 "$APK" | cut -d " " -f 1 > "$APK".sha256
shasum -a 256 "$AAB" | cut -d " " -f 1 > "$AAB".sha256
shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
cp "$APK".sha256 ${{ env.prefix }}.apk.sha256
cp "$AAB".sha256 ${{ env.prefix }}.aab.sha256
s3cmd put --acl-public "$APK" ${{ env.version_file }} "$APK".sha256 ${{ env.prefix }}.apk.sha256 ${{ env.prefix }}.apk "s3://$S3_BUCKET"
s3cmd put --acl-public "$APK" "$APK".sha256 ${{ env.update }} ${{ env.update }}.sha256 ${{ env.version_file }} ${{ env.prefix }}.apk.sha256 ${{ env.prefix }}.apk "s3://$S3_BUCKET"
s3cmd put --acl-public "$AAB" "$AAB".sha256 ${{ env.prefix }}.aab.sha256 ${{ env.prefix }}.aab "s3://$S3_BUCKET"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/$APK"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/${{ env.prefix }}.apk"
Expand Down
45 changes: 35 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ TEST ?= *_test
# integration-test:
# @flutter drive --driver test_driver/integration_driver.dart --debug --flavor prod --target `ls integration_test/$(TEST).dart`

TAG ?= $$VERSION
APP ?= lantern
CAPITALIZED_APP := Lantern

TAG ?= $(APP)-$$VERSION
TAG_HEAD := $(shell git rev-parse HEAD)
INSTALLER_NAME ?= lantern-installer
CHANGELOG_NAME ?= CHANGELOG.md
Expand All @@ -53,6 +56,11 @@ PACKAGE_MAINTAINER := Lantern Team <[email protected]>
PACKAGE_VENDOR := Brave New Software Project, Inc
PACKAGE_URL := https://lantern.io

GH_USER ?= getlantern
GH_RELEASE_REPOSITORY ?= lantern
BINARIES_PATH ?= ../lantern-binaries
BINARIES_BRANCH ?= main

APP_DESCRIPTION := Censorship circumvention tool
APP_EXTENDED_DESCRIPTION := Lantern allows you to access sites blocked by internet censorship.\nWhen you run it, Lantern reroutes traffic to selected domains through servers located where such domains are uncensored.

Expand All @@ -63,6 +71,7 @@ NODE := $(call get-command,node)
NPM := $(call get-command,npm)
GULP := $(call get-command,gulp)
AWSCLI := $(call get-command,aws)
S3CMD := $(call get-command,s3cmd)
CHANGE := $(call get-command,git-chglog)
PIP := $(call get-command,pip)
WGET := $(call get-command,wget)
Expand Down Expand Up @@ -105,9 +114,6 @@ LDFLAGS := -X github.com/getlantern/lantern-client/internalsdk/common.RevisionDa
# DISABLE_OPTIMIZATION_FLAGS := -gcflags="all=-N -l"
GOMOBILE_EXTRA_BUILD_FLAGS :=

BINARIES_PATH ?= ../lantern-binaries
BINARIES_BRANCH ?= main

BETA_BASE_NAME ?= $(INSTALLER_NAME)-preview
PROD_BASE_NAME ?= $(INSTALLER_NAME)

Expand All @@ -131,8 +137,6 @@ SENTRY_PROJECT_IOS=lantern-ios
DWARF_DSYM_FOLDER_PATH=$(shell pwd)/build/ios/Release-prod-iphoneos/Runner.app.dSYM
INFO_PLIST := ios/Runner/Info.plist

APP ?= lantern
CAPITALIZED_APP := Lantern
DESKTOP_LIB_NAME ?= liblantern
DARWIN_LIB_NAME ?= $(DESKTOP_LIB_NAME).dylib
DARWIN_LIB_AMD64 ?= $(DESKTOP_LIB_NAME)_amd64.dylib
Expand Down Expand Up @@ -308,7 +312,10 @@ require-awscli:

.PHONY: require-s3cmd
require-s3cmd:
@if [[ -z "s3cmd" ]]; then echo 'Missing "s3cmd" command. Use "brew install s3cmd" or see https://github.com/s3tools/s3cmd/blob/master/INSTALL'; exit 1; fi
@if [[ -z "$(S3CMD)" ]]; then echo 'Missing "s3cmd" command. Use "brew install s3cmd" or see https://github.com/s3tools/s3cmd/blob/master/INSTALL.md'; exit 1; fi

.PHONY: require-gh-token
require-gh-token: guard-GH_TOKEN

.PHONY: require-changelog
require-changelog:
Expand Down Expand Up @@ -342,9 +349,25 @@ require-appdmg:
require-retry:
@if [[ -z "$(RETRY)" ]]; then echo 'Missing retry command. Try go install github.com/joshdk/retry'; exit 1; fi

release-autoupdate: require-version
@curl https://s3.amazonaws.com/lantern/lantern-installer.apk | bzip2 > update_android_arm.bz2 && \
$(RUBY) ./create_or_update_release.rb getlantern lantern $$VERSION update_android_arm.bz2
.PHONY: require-ruby
require-ruby:
@if [[ -z "$(RUBY)" ]]; then echo 'Missing "ruby" command.'; exit 1; fi

.PHONY: auto-updates
auto-updates: require-version require-s3cmd require-gh-token require-ruby
@TAG_COMMIT=$$(git rev-list --abbrev-commit -1 $(TAG)) && \
if [[ -z "$$TAG_COMMIT" ]]; then \
echo "Could not find given tag $(TAG)."; \
fi && \
for URL in $$($(S3CMD) ls s3://$(S3_BUCKET)/ | grep -v "sha256" | grep $(APP)_update_ | grep -F "$$VERSION." | awk '{print $$4}'); do \
NAME=$$(basename $$URL) && \
STRIPPED_NAME=$$(echo "$$NAME" | cut -d - -f 1 | sed s/$(APP)_//).bz2 && \
$(S3CMD) get --force s3://$(S3_BUCKET)/$$NAME $$STRIPPED_NAME && \
ALL="$$ALL $$STRIPPED_NAME"; \
done && \
ALL=`echo $$ALL | xargs` && \
echo "Uploading $$ALL for auto-updates" && \
echo $$ALL | xargs $(RUBY) ./$(INSTALLER_RESOURCES)/tools/create_or_update_release.rb $(GH_USER) $(GH_RELEASE_REPOSITORY) $$VERSION

release: require-version require-s3cmd require-wget require-lantern-binaries require-release-track release-prod copy-beta-installers-to-mirrors invalidate-getlantern-dot-org upload-aab-to-play

Expand Down Expand Up @@ -575,6 +598,8 @@ $(INSTALLER_NAME).dmg: require-version require-appdmg require-retry require-magi
$(call osxcodesign,$$DARWIN_APP_NAME/Contents/Frameworks/liblantern.dylib) && \
$(call osxcodesign,$$DARWIN_APP_NAME/Contents/MacOS/Lantern) && \
$(call osxcodesign,$$DARWIN_APP_NAME) && \
cat $(DARWIN_APP_NAME)/Contents/MacOS/$(APP) | bzip2 > $(APP)_update_darwin.bz2 && \
ls -l $(APP)_update_darwin.bz2 && \
rm -rf $(INSTALLER_NAME).dmg && \
sed "s/__VERSION__/$$VERSION/g" $$INSTALLER_RESOURCES/dmgbackground.svg > $$INSTALLER_RESOURCES/dmgbackground_versioned.svg && \
$(MAGICK) -size 600x400 $$INSTALLER_RESOURCES/dmgbackground_versioned.svg $$INSTALLER_RESOURCES/dmgbackground.png && \
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,11 @@ To publish a release on Google Play, go to the Lantern App on the [Google Play C
Just because something's been released to prod doesn't mean clients will auto-update, there's an additional step for that. The below will release the current production version to autoupdate. Please make sure the VERSION parameter matches the current production version.

```
GH_TOKEN=<token> VERSION=7.2.0 make release-autoupdate
GH_TOKEN=<token> VERSION=7.2.0 make auto-updates
```

To find the latest version that's been set for auto updates, check the [lantern](https://github.com/getlantern/lantern/releases) repo.

You can obtain the GH_TOKEN for releasing auto-updates from [1Password](https://start.1password.com/open/i?a=HHU7O6L7H5E33C6UDFD6Q3SYH4&v=nupvcrpazomdrozlmemsywqfj4&i=qlxf7ffkjnhu7nqkshvwi7ocpm&h=lantern.1password.com).

### Testing Auto-Update with release builds
Expand Down
Loading