diff --git a/.github/workflows/build-darwin.yml b/.github/workflows/build-darwin.yml index 5c50a5a7b..6abe2e21b 100644 --- a/.github/workflows/build-darwin.yml +++ b/.github/workflows/build-darwin.yml @@ -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" \ No newline at end of file + s3cmd put --acl-public "$DMG" "$DMG".sha256 ${{ env.update }} ${{ env.update }}.sha256 ${{ env.version_file }} ${{ env.prefix }}.dmg.sha256 ${{ env.prefix }}.dmg "s3://lantern" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ff993ce7..8e5b5c443 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -228,7 +228,10 @@ 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 @@ -236,9 +239,10 @@ jobs: 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" diff --git a/Makefile b/Makefile index 35b443981..ad8be6567 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -53,6 +56,11 @@ PACKAGE_MAINTAINER := Lantern Team 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. @@ -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) @@ -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) @@ -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 @@ -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: @@ -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 @@ -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 && \ diff --git a/README.md b/README.md index 52cb04b1d..ca9c23726 100644 --- a/README.md +++ b/README.md @@ -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= VERSION=7.2.0 make release-autoupdate +GH_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