Skip to content

Commit 1c2345c

Browse files
committed
update release to be manual
1 parent a28cca1 commit 1c2345c

File tree

7 files changed

+32
-30
lines changed

7 files changed

+32
-30
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will build a Swift project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3-
41
name: Integration tests
52

63
on:

.github/workflows/release.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# This workflow will build a Swift project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3-
41
name: Release MacOS app
52

63
on:
7-
push:
8-
branches: [ "main" ]
94
pull_request: # TODO: Remove
105
branches: [ "main" ]
116
concurrency:
@@ -31,11 +26,12 @@ jobs:
3126
run: cd local-server && yarn install
3227
- uses: actions/checkout@v4
3328
- name: Make release
34-
run: cd app && fastlane mac distribute_release --verbose
29+
run: cd app && fastlane mac distribute_release
3530
env:
3631
FASTLANE_MACH_REPO_GITHUB_ACCESS_TOKEN: ${{ secrets.FASTLANE_MACH_REPO_GITHUB_ACCESS_TOKEN }}
3732
MATCH_PASSWORD: ${{ secrets.FASTLANE_MACH_PASSWORD }}
3833
NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
3934
NOTARY_P8: ${{ secrets.NOTARY_P8 }}
4035
NOTARY_ISSUER_ID: ${{ secrets.NOTARY_ISSUER_ID }}
4136
SPARKLE_SECRET_KEY: ${{ secrets.SPARKLE_SECRET_KEY }}
37+
GH_WRITE_TOKEN: ${{ secrets.GH_WRITE_TOKEN }}

app/command.shared.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RELEASE_SHARED_USER_DEFAULTS_SUITE = $(TeamIdentifierPrefix)dev.getcmd.shared
66

77
INFOPLIST_KEY_ReleaseUserDefaultsSharedSuiteName = $(RELEASE_SHARED_USER_DEFAULTS_SUITE)
88
INFOPLIST_KEY_DebugUserDefaultsSharedSuiteName = $(DEBUG_SHARED_USER_DEFAULTS_SUITE)
9-
APP_VERSION=0.0.31
9+
APP_VERSION=0.0.32
1010
MARKETING_VERSION=$(APP_VERSION)
1111

1212
RELEASE_APP_BUNDLE_IDENTIFIER = dev.getcmd.command

app/command/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<key>ReleaseUserDefaultsSharedSuiteName</key>
1212
<string>$(INFOPLIST_KEY_ReleaseUserDefaultsSharedSuiteName)</string>
1313
<key>SUFeedURL</key>
14-
<string>https://raw.githubusercontent.com/gsabran/test/refs/heads/main/appcast.xml</string>
14+
<string>https://raw.githubusercontent.com/getcmd-dev/cmd/refs/heads/main/appcast.xml</string>
1515
<key>SUPublicEDKey</key>
1616
<string>oIUy9brsbVznI5y2tOrX59KVITPCxYltusDhv4z9byE=</string>
1717
<key>UserDefaultsSharedSuiteName</key>

app/fastlane/Fastfile

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ platform :mac do
7373
desc "Build, archive and sign the app for distribution"
7474
lane :create_and_sign_release do |options|
7575
remove_zip = options.fetch(:remove_zip, true)
76+
version = options.fetch(:version, nil)
7677
setup_ci if ENV['CI']
7778

7879
personal_github_access_token = load_secret("FASTLANE_MACH_REPO_GITHUB_ACCESS_TOKEN")
@@ -167,11 +168,9 @@ platform :mac do
167168

168169
sparkle_output = sh("echo '#{sparkle_secret_key}' | #{sparkle_path}/bin/sign_update #{app_zip_path} --ed-key-file -")
169170
app_config_path = File.absolute_path("../command.shared.xcconfig")
170-
version = sh("cat #{app_config_path} | grep APP_VERSION=").split("APP_VERSION=").last.strip
171-
172-
puts "version: #{version}"
171+
version = version || sh("cat #{app_config_path} | grep APP_VERSION=").split("APP_VERSION=").last.strip
173172

174-
puts "Notarization completed successfully. app_path: #{app_path}"
173+
puts "Notarization completed successfully. version: #{version}, app_path: #{app_path}"
175174

176175
appcast_template_path = File.absolute_path("./appcast.template.xml")
177176
appcast_path = File.absolute_path("./appcast.xml")
@@ -187,7 +186,23 @@ platform :mac do
187186

188187
desc "Build, archive, sign and publish the app for distribution"
189188
lane :distribute_release do
190-
result = create_and_sign_release(remove_zip: false)
189+
app_config_path = File.absolute_path("../command.shared.xcconfig")
190+
version = sh("cat #{app_config_path} | grep APP_VERSION=").split("APP_VERSION=").last.strip
191+
# Look for an existing version tag. If one exist, bump the version.
192+
existing_version = sh("git ls-remote origin refs/tags/v#{version}").strip
193+
if existing_version.empty?
194+
puts "Using version: #{version}"
195+
else
196+
version_parts = version.split('.')
197+
version_parts[-1] = (version_parts[-1].to_i + 1).to_s
198+
new_version = version_parts.join('.')
199+
puts "Bumping version from #{version} to #{new_version}."
200+
201+
sh("sed -i '' 's/APP_VERSION=#{version}/APP_VERSION=#{new_version}/' #{app_config_path}")
202+
version = new_version
203+
end
204+
205+
result = create_and_sign_release(remove_zip: false, version: version)
191206
version = result[:version]
192207
app_zip_path = result[:app_zip_path]
193208
build_path = result[:build_path]
@@ -203,19 +218,13 @@ platform :mac do
203218
upload_assets: app_zip_path
204219
)
205220

206-
set_github_release(
207-
api_token: load_secret("GITHUB_TEST_TOKEN"),
208-
server_url: "https://api.github.com",
209-
repository_name: "gsabran/test",
210-
name: "v#{version}",
211-
tag_name: "v#{version}",
212-
description: "test release",
213-
commitish: "main",
214-
upload_assets: app_zip_path
215-
)
216-
217221
sh("rm -rf #{build_path}")
218222

219-
puts "👉 Don't forget to push the changes to appcast.xml"
223+
create_pull_request(
224+
api_token: load_secret("GH_WRITE_TOKEN"),
225+
repo: "getcmd-dev/cmd",
226+
title: "Release v#{version}",
227+
base: "main"
228+
)
220229
end
221230
end

app/fastlane/appcast.template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]]>
1616
</description>
1717
<pubDate>Tue, 29 Mar 2022 15:20:11 +0000</pubDate>
18-
<enclosure url="https://github.com/gsabran/test/releases/download/vREPLACE_SPARKLE_VERSION/command.app.zip" REPLACE_SPARKLE_SIGN_UPDATE />
18+
<enclosure url="https://github.com/getcmd-dev/cmd/releases/download/vREPLACE_SPARKLE_VERSION/command.app.zip" REPLACE_SPARKLE_SIGN_UPDATE />
1919
</item>
2020
</channel>
2121
</rss>

app/fastlane/appcast.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ new line
1616
]]>
1717
</description>
1818
<pubDate>Tue, 29 Mar 2022 15:20:11 +0000</pubDate>
19-
<enclosure url="https://github.com/gsabran/test/releases/download/v0.0.31/command.app.zip" sparkle:edSignature="LLqCu7OZCczUSt1nIebS3fOvG7oyu2FBwaXkFsyNWXgNLR76IpIRtnGGu+VhAc6F8FtR+bbF3x+dTHfv/pQvCQ==" length="26684595"
19+
<enclosure url="https://github.com/getcmd-dev/cmd/releases/download/v0.0.31/command.app.zip" sparkle:edSignature="LLqCu7OZCczUSt1nIebS3fOvG7oyu2FBwaXkFsyNWXgNLR76IpIRtnGGu+VhAc6F8FtR+bbF3x+dTHfv/pQvCQ==" length="26684595"
2020
/>
2121
</item>
2222
</channel>

0 commit comments

Comments
 (0)