From 9e5453f66253797303dd38c9274df04dd2727d36 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 01:37:09 +0000 Subject: [PATCH 01/20] ci: download mutagen binary into resources --- .github/workflows/release.yml | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebe8e9c..b7ca627 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,13 @@ on: release: types: [published] + workflow_dispatch: + inputs: + dryrun: + description: 'Run in dry-run mode (upload as artifact instead of release asset)' + required: true + type: boolean + default: false permissions: {} # Cancel in-progress runs for when multiple PRs get merged @@ -23,6 +30,8 @@ jobs: permissions: # To upload assets to the release contents: write + # Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage) + id-token: write steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -38,6 +47,22 @@ jobs: - name: Setup Nix uses: ./.github/actions/nix-devshell + - name: Authenticate to Google Cloud + id: gcloud_auth + uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 + with: + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }} + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + token_format: "access_token" + + - name: Setup GCloud SDK + uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4 + + - name: Insert Mutagen resources + run: | + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "Coder Desktop/Resources/mutagen-agents.tar.gz" + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-linux-amd64 "Coder Desktop/Resources/mutagen-linux-amd64" - name: Build env: @@ -51,7 +76,18 @@ jobs: EXT_PROF: ${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }} run: make release + # Upload as artifact in dry-run mode + - name: Upload Build Artifact + if: ${{ inputs.dryrun }} + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: coder-desktop-build + path: ${{ github.workspace }}/out + retention-days: 7 + + # Upload to release in non-dry-run mode - name: Upload Release Assets + if: ${{ !inputs.dryrun }} run: gh release upload "$RELEASE_TAG" "$out"/* --clobber env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -60,7 +96,7 @@ jobs: update-cask: name: Update homebrew-coder cask runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}} - if: ${{ github.repository_owner == 'coder' }} + if: ${{ github.repository_owner == 'coder' && !inputs.dryrun }} needs: build steps: - name: Checkout From 560765a8d2f3d07235a96e5e6d6d35273603f390 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 01:42:16 +0000 Subject: [PATCH 02/20] retry --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7ca627..2d4c950 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,10 +79,10 @@ jobs: # Upload as artifact in dry-run mode - name: Upload Build Artifact if: ${{ inputs.dryrun }} - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: coder-desktop-build - path: ${{ github.workspace }}/out + path: ${{ github.workspace }}/outputs//out retention-days: 7 # Upload to release in non-dry-run mode From 783e3735d6a126f3468546dc73d1e4363c1936c5 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 01:50:42 +0000 Subject: [PATCH 03/20] retry --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d4c950..3e873c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,7 @@ jobs: run: | gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "Coder Desktop/Resources/mutagen-agents.tar.gz" gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-linux-amd64 "Coder Desktop/Resources/mutagen-linux-amd64" + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" - name: Build env: From e6e2c0a255624652e0b593cd03edfd6b09ed24e7 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 14:23:16 +1100 Subject: [PATCH 04/20] retry --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e873c6..2ed5fcd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: - name: Insert Mutagen resources run: | gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "Coder Desktop/Resources/mutagen-agents.tar.gz" - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-arm64 "Coder Desktop/Resources/mutagen-darwin-arm64" gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" - name: Build From 2ecf6dd1bf095b052bae9ad51958d8a681a71c6c Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 14:34:21 +1100 Subject: [PATCH 05/20] retry --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ed5fcd..7e65496 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,7 +82,7 @@ jobs: uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: coder-desktop-build - path: ${{ github.workspace }}/outputs//out + path: ${{ github.workspace }}/outputs/out retention-days: 7 # Upload to release in non-dry-run mode From 57cdaf27a798db323f97609464c1cab43904de99 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 18:02:03 +1100 Subject: [PATCH 06/20] chmod --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e65496..d8997d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,6 +63,8 @@ jobs: gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "Coder Desktop/Resources/mutagen-agents.tar.gz" gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-arm64 "Coder Desktop/Resources/mutagen-darwin-arm64" gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" + chmod +x "Coder Desktop/Resources/mutagen-darwin-arm64" + chmod +x "Coder Desktop/Resources/mutagen-darwin-amd64" - name: Build env: From 632d2b2968cad048198370f53175d37b86199a9a Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 21:29:56 +1100 Subject: [PATCH 07/20] flake & makefile --- .github/workflows/release.yml | 12 +----------- Makefile | 25 +++++++++++++++++++++++-- flake.nix | 1 + 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8997d8..0f63095 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,7 @@ jobs: - name: Setup Nix uses: ./.github/actions/nix-devshell + - name: Authenticate to Google Cloud id: gcloud_auth uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 @@ -55,17 +56,6 @@ jobs: service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} token_format: "access_token" - - name: Setup GCloud SDK - uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4 - - - name: Insert Mutagen resources - run: | - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "Coder Desktop/Resources/mutagen-agents.tar.gz" - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-arm64 "Coder Desktop/Resources/mutagen-darwin-arm64" - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "Coder Desktop/Resources/mutagen-darwin-amd64" - chmod +x "Coder Desktop/Resources/mutagen-darwin-arm64" - chmod +x "Coder Desktop/Resources/mutagen-darwin-amd64" - - name: Build env: APPLE_DEVELOPER_ID_PKCS12_B64: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }} diff --git a/Makefile b/Makefile index f31e8b1..8ccaf9a 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,22 @@ APP_SIGNING_KEYCHAIN := $(if $(wildcard $(KEYCHAIN_FILE)),$(shell realpath $(KEY setup: \ $(XCPROJECT) \ $(PROJECT)/VPNLib/vpn.pb.swift \ - $(PROJECT)/VPNLib/FileSync/daemon.pb.swift + $(PROJECT)/VPNLib/FileSync/daemon.pb.swift \ + $(PROJECT)/Resources/mutagen-agents.tar.gz \ + $(PROJECT)/Resources/mutagen-darwin-arm64 \ + $(PROJECT)/Resources/mutagen-darwin-amd64 + +# Mutagen resources +$(PROJECT)/Resources/mutagen-agents.tar.gz: + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "$@" + +$(PROJECT)/Resources/mutagen-darwin-arm64: + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-arm64 "$@" + chmod +x "$@" + +$(PROJECT)/Resources/mutagen-darwin-amd64: + gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "$@" + chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml cd $(PROJECT); \ @@ -113,7 +128,7 @@ lint/actions: ## Lint GitHub Actions zizmor . .PHONY: clean -clean: clean/project clean/keychain clean/build ## Clean project and artifacts +clean: clean/project clean/keychain clean/build clean/mutagen ## Clean project and artifacts .PHONY: clean/project clean/project: @@ -136,6 +151,12 @@ clean/keychain: clean/build: rm -rf build/ release/ $$out +.PHONY: clean/mutagen +clean/mutagen: + rm -f "$(PROJECT)/Resources/mutagen-agents.tar.gz" + rm -f "$(PROJECT)/Resources/mutagen-darwin-arm64" + rm -f "$(PROJECT)/Resources/mutagen-darwin-amd64" + .PHONY: proto proto: $(PROJECT)/VPNLib/vpn.pb.swift $(PROJECT)/VPNLib/FileSync/daemon.pb.swift ## Generate Swift files from protobufs diff --git a/flake.nix b/flake.nix index ab3ab0a..1d67c4c 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,7 @@ gh git gnumake + google-cloud-sdk protobuf_28 grpc-swift.packages.${system}.protoc-gen-grpc-swift grpc-swift.packages.${system}.protoc-gen-swift From b77dda7c75e99747a29066d409a1f6636c124ad5 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Mon, 10 Mar 2025 21:54:43 +1100 Subject: [PATCH 08/20] fixup --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8ccaf9a..93a623a 100644 --- a/Makefile +++ b/Makefile @@ -153,9 +153,9 @@ clean/build: .PHONY: clean/mutagen clean/mutagen: - rm -f "$(PROJECT)/Resources/mutagen-agents.tar.gz" - rm -f "$(PROJECT)/Resources/mutagen-darwin-arm64" - rm -f "$(PROJECT)/Resources/mutagen-darwin-amd64" + rm -f $(PROJECT)/Resources/mutagen-agents.tar.gz + rm -f $(PROJECT)/Resources/mutagen-darwin-arm64 + rm -f $(PROJECT)/Resources/mutagen-darwin-amd64 .PHONY: proto proto: $(PROJECT)/VPNLib/vpn.pb.swift $(PROJECT)/VPNLib/FileSync/daemon.pb.swift ## Generate Swift files from protobufs From c6506e9000090b40f661e82a0cbe7c038ed7b580 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 12:06:47 +1100 Subject: [PATCH 09/20] improve clean & download --- .gitignore | 4 ++++ Makefile | 22 +++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index e6983d3..70943ca 100644 --- a/.gitignore +++ b/.gitignore @@ -302,3 +302,7 @@ release/ # marker files .fl5C1A396C + + +# Embedded mutagen resources +Coder Desktop/Resources/mutagen-* \ No newline at end of file diff --git a/Makefile b/Makefile index 93a623a..2079d6a 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ XCPROJECT := Coder\ Desktop/Coder\ Desktop.xcodeproj SCHEME := Coder\ Desktop SWIFT_VERSION := 6.0 +MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64 +MUTAGEN_VERSION := v0.18.1 + ifndef CURRENT_PROJECT_VERSION CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags) endif @@ -35,20 +38,11 @@ setup: \ $(XCPROJECT) \ $(PROJECT)/VPNLib/vpn.pb.swift \ $(PROJECT)/VPNLib/FileSync/daemon.pb.swift \ - $(PROJECT)/Resources/mutagen-agents.tar.gz \ - $(PROJECT)/Resources/mutagen-darwin-arm64 \ - $(PROJECT)/Resources/mutagen-darwin-amd64 + $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)) # Mutagen resources -$(PROJECT)/Resources/mutagen-agents.tar.gz: - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-agents.tar.gz "$@" - -$(PROJECT)/Resources/mutagen-darwin-arm64: - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-arm64 "$@" - chmod +x "$@" - -$(PROJECT)/Resources/mutagen-darwin-amd64: - gsutil cp gs://coder-desktop/mutagen/v0.18.1/mutagen-darwin-amd64 "$@" +$(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): + gsutil cp "gs://coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(subst Coder ,,$(notdir $@))" "$@" chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml @@ -153,9 +147,7 @@ clean/build: .PHONY: clean/mutagen clean/mutagen: - rm -f $(PROJECT)/Resources/mutagen-agents.tar.gz - rm -f $(PROJECT)/Resources/mutagen-darwin-arm64 - rm -f $(PROJECT)/Resources/mutagen-darwin-amd64 + find $(PROJECT)/Resources -name 'mutagen-*' -delete .PHONY: proto proto: $(PROJECT)/VPNLib/vpn.pb.swift $(PROJECT)/VPNLib/FileSync/daemon.pb.swift ## Generate Swift files from protobufs From e85113eb2a1bb6eac9a95fe070ee7cd37a7b9785 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 15:11:05 +1100 Subject: [PATCH 10/20] remove google cloud auth --- .github/workflows/release.yml | 8 -------- Makefile | 2 +- flake.nix | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f63095..78c8cb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,14 +48,6 @@ jobs: - name: Setup Nix uses: ./.github/actions/nix-devshell - - name: Authenticate to Google Cloud - id: gcloud_auth - uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 - with: - workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }} - service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} - token_format: "access_token" - - name: Build env: APPLE_DEVELOPER_ID_PKCS12_B64: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }} diff --git a/Makefile b/Makefile index 2079d6a..edb2de1 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ setup: \ # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): - gsutil cp "gs://coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(subst Coder ,,$(notdir $@))" "$@" + curl -sL "https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(subst Coder ,,$(notdir $@))" -o "$@" chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml diff --git a/flake.nix b/flake.nix index 1d67c4c..ab3ab0a 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ gh git gnumake - google-cloud-sdk protobuf_28 grpc-swift.packages.${system}.protoc-gen-grpc-swift grpc-swift.packages.${system}.protoc-gen-swift From 7f48e45ec29fe3b5090233d161e552da198351c0 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 15:11:24 +1100 Subject: [PATCH 11/20] newline --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 70943ca..8624a79 100644 --- a/.gitignore +++ b/.gitignore @@ -303,6 +303,5 @@ release/ # marker files .fl5C1A396C - # Embedded mutagen resources Coder Desktop/Resources/mutagen-* \ No newline at end of file From 3e29f02f6e7c262be64f9943ffea0c7b30b66521 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 15:29:49 +1100 Subject: [PATCH 12/20] switch to basename --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index edb2de1..d71f6fb 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ setup: \ # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): - curl -sL "https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(subst Coder ,,$(notdir $@))" -o "$@" + curl -sL "https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(shell basename "$@")" -o "$@" chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml From e2b57da30327a6831e70ddb36a1dc04fea6f326b Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 15:53:38 +1100 Subject: [PATCH 13/20] improvement --- Coder Desktop/Resources/.gitkeep | 0 Coder Desktop/Resources/.mutagenversion | 1 + Makefile | 24 +++++++++++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) delete mode 100644 Coder Desktop/Resources/.gitkeep create mode 100644 Coder Desktop/Resources/.mutagenversion diff --git a/Coder Desktop/Resources/.gitkeep b/Coder Desktop/Resources/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Coder Desktop/Resources/.mutagenversion b/Coder Desktop/Resources/.mutagenversion new file mode 100644 index 0000000..4683120 --- /dev/null +++ b/Coder Desktop/Resources/.mutagenversion @@ -0,0 +1 @@ +v0.18.1 \ No newline at end of file diff --git a/Makefile b/Makefile index d71f6fb..42bdfbe 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,18 @@ +# Use a single bash shell for each job, and immediately exit on failure +SHELL := bash +.SHELLFLAGS := -ceu +.ONESHELL: + +# This doesn't work on directories. +# See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets +.DELETE_ON_ERROR: + +# Don't print the commands in the file unless you specify VERBOSE. This is +# # essentially the same as putting "@" at the start of each line. +ifndef VERBOSE +.SILENT: +endif + ifdef CI LINTFLAGS := --reporter github-actions-logging FMTFLAGS := --lint --reporter github-actions-log @@ -12,7 +27,6 @@ SCHEME := Coder\ Desktop SWIFT_VERSION := 6.0 MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64 -MUTAGEN_VERSION := v0.18.1 ifndef CURRENT_PROJECT_VERSION CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags) @@ -41,8 +55,12 @@ setup: \ $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)) # Mutagen resources -$(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): - curl -sL "https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$(shell basename "$@")" -o "$@" +$(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion + version=$$(cat "$<") + filename=$$(basename "$@") + url="https://storage.googleapis.com/coder-desktop/mutagen/$${version}/$${filename}" + echo "Downloading from $${url}" + curl -sL $${url} -o "$@" chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml From fa835d03f66947bd01e3be72ca47ba6e573c306e Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 16:00:46 +1100 Subject: [PATCH 14/20] improvement --- .gitignore | 2 +- Coder Desktop/Resources/.mutagenversion | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8624a79..a1b91af 100644 --- a/.gitignore +++ b/.gitignore @@ -304,4 +304,4 @@ release/ .fl5C1A396C # Embedded mutagen resources -Coder Desktop/Resources/mutagen-* \ No newline at end of file +Coder Desktop/Resources/mutagen-* diff --git a/Coder Desktop/Resources/.mutagenversion b/Coder Desktop/Resources/.mutagenversion index 4683120..f3a5a57 100644 --- a/Coder Desktop/Resources/.mutagenversion +++ b/Coder Desktop/Resources/.mutagenversion @@ -1 +1 @@ -v0.18.1 \ No newline at end of file +v0.18.1 diff --git a/Makefile b/Makefile index 42bdfbe..b5e9fca 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ setup: \ # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion - version=$$(cat "$<") + version=$$(printf "%s" "$$(cat "$<")") filename=$$(basename "$@") url="https://storage.googleapis.com/coder-desktop/mutagen/$${version}/$${filename}" echo "Downloading from $${url}" From 85acb776694bb28dbdd7371e3462a62430a4aac2 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 21:19:08 +1100 Subject: [PATCH 15/20] remove unused perm --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78c8cb6..c86eb17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,8 +30,6 @@ jobs: permissions: # To upload assets to the release contents: write - # Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage) - id-token: write steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 8a13b4340412c7793b047885d6ea47c5fbc6e2ef Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 22:49:31 +1100 Subject: [PATCH 16/20] validate mutagen version --- Makefile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b5e9fca..c3e1cf7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -# Use a single bash shell for each job, and immediately exit on failure +# Use bash and immediately exit on failure SHELL := bash .SHELLFLAGS := -ceu -.ONESHELL: # This doesn't work on directories. # See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets @@ -14,11 +13,11 @@ ifndef VERBOSE endif ifdef CI -LINTFLAGS := --reporter github-actions-logging -FMTFLAGS := --lint --reporter github-actions-log + LINTFLAGS := --reporter github-actions-logging + FMTFLAGS := --lint --reporter github-actions-log else -LINTFLAGS := -FMTFLAGS := + LINTFLAGS := + FMTFLAGS := endif PROJECT := Coder\ Desktop @@ -27,6 +26,12 @@ SCHEME := Coder\ Desktop SWIFT_VERSION := 6.0 MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64 +ifndef MUTAGEN_VERSION + MUTAGEN_VERSION:=$(shell grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' $(PROJECT)/Resources/.mutagenversion) +endif +ifeq ($(strip $(MUTAGEN_VERSION)),) + $(error MUTAGEN_VERSION must be a valid version) +endif ifndef CURRENT_PROJECT_VERSION CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags) @@ -56,9 +61,7 @@ setup: \ # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion - version=$$(printf "%s" "$$(cat "$<")") - filename=$$(basename "$@") - url="https://storage.googleapis.com/coder-desktop/mutagen/$${version}/$${filename}" + url="https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$$(basename "$@")" echo "Downloading from $${url}" curl -sL $${url} -o "$@" chmod +x "$@" From 971571808e57fcda00fb94be3dfb42508a198048 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 23:01:44 +1100 Subject: [PATCH 17/20] remove tabs --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c3e1cf7..23b73eb 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,11 @@ ifndef VERBOSE endif ifdef CI - LINTFLAGS := --reporter github-actions-logging - FMTFLAGS := --lint --reporter github-actions-log +LINTFLAGS := --reporter github-actions-logging +FMTFLAGS := --lint --reporter github-actions-log else - LINTFLAGS := - FMTFLAGS := +LINTFLAGS := +FMTFLAGS := endif PROJECT := Coder\ Desktop @@ -27,24 +27,24 @@ SWIFT_VERSION := 6.0 MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64 ifndef MUTAGEN_VERSION - MUTAGEN_VERSION:=$(shell grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' $(PROJECT)/Resources/.mutagenversion) +MUTAGEN_VERSION:=$(shell grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' $(PROJECT)/Resources/.mutagenversion) endif ifeq ($(strip $(MUTAGEN_VERSION)),) - $(error MUTAGEN_VERSION must be a valid version) +$(error MUTAGEN_VERSION must be a valid version) endif ifndef CURRENT_PROJECT_VERSION - CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags) +CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags) endif ifeq ($(strip $(CURRENT_PROJECT_VERSION)),) - $(error CURRENT_PROJECT_VERSION cannot be empty) +$(error CURRENT_PROJECT_VERSION cannot be empty) endif ifndef MARKETING_VERSION - MARKETING_VERSION:=$(shell git describe --match 'v[0-9]*' --tags --abbrev=0 | sed 's/^v//' | sed 's/-.*$$//') +MARKETING_VERSION:=$(shell git describe --match 'v[0-9]*' --tags --abbrev=0 | sed 's/^v//' | sed 's/-.*$$//') endif ifeq ($(strip $(MARKETING_VERSION)),) - $(error MARKETING_VERSION cannot be empty) +$(error MARKETING_VERSION cannot be empty) endif # Define the keychain file name first From 7bb448bc3f20d157548c7b6b893932c3e1e6d2d2 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 11 Mar 2025 23:07:07 +1100 Subject: [PATCH 18/20] add back oneshell --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 23b73eb..cbbba92 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ -# Use bash and immediately exit on failure +# Use a single bash shell for each job, and immediately exit on failure SHELL := bash .SHELLFLAGS := -ceu +.ONESHELL: # This doesn't work on directories. # See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets From 1780f03f5716048e264d93551e430b82d1f5d28e Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Wed, 12 Mar 2025 12:37:58 +1100 Subject: [PATCH 19/20] undo --- Makefile | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index cbbba92..b1e5e13 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,11 @@ -# Use a single bash shell for each job, and immediately exit on failure +# Use bash, and immediately exit on failure SHELL := bash .SHELLFLAGS := -ceu -.ONESHELL: # This doesn't work on directories. # See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets .DELETE_ON_ERROR: -# Don't print the commands in the file unless you specify VERBOSE. This is -# # essentially the same as putting "@" at the start of each line. -ifndef VERBOSE -.SILENT: -endif - ifdef CI LINTFLAGS := --reporter github-actions-logging FMTFLAGS := --lint --reporter github-actions-log @@ -62,9 +55,7 @@ setup: \ # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion - url="https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$$(basename "$@")" - echo "Downloading from $${url}" - curl -sL $${url} -o "$@" + curl -sL "https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$$(basename "$@")" -o "$@" chmod +x "$@" $(XCPROJECT): $(PROJECT)/project.yml From 52d887610d6202d460cea0538fc1f663ab0e0a79 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Wed, 12 Mar 2025 16:16:39 +1100 Subject: [PATCH 20/20] download mutagen before xcodegen --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b1e5e13..259c1ce 100644 --- a/Makefile +++ b/Makefile @@ -48,10 +48,10 @@ APP_SIGNING_KEYCHAIN := $(if $(wildcard $(KEYCHAIN_FILE)),$(shell realpath $(KEY .PHONY: setup setup: \ + $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)) \ $(XCPROJECT) \ $(PROJECT)/VPNLib/vpn.pb.swift \ - $(PROJECT)/VPNLib/FileSync/daemon.pb.swift \ - $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)) + $(PROJECT)/VPNLib/FileSync/daemon.pb.swift # Mutagen resources $(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion