-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
whole lotta changes, mainly adding auto updates (to be completed)
- Loading branch information
Showing
17 changed files
with
434 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,17 +21,28 @@ jobs: | |
action: build | ||
configuration: Release | ||
- name: (debug) show filetree | ||
run: brew install tree && tree -a && tree -a ~/Library/Developer/Xcode/DerivedData | ||
run: | | ||
brew install tree | ||
tree -a | ||
tree -a ~/Library/Developer/Xcode/DerivedData | ||
- name: Compress app bundle | ||
run: | | ||
mv ~/Library/Developer/Xcode/DerivedData/M1necraft-*/Build/Products/Release/M1necraft.app . | ||
zip -r -y M1necraft.app.zip M1necraft.app | ||
- name: Copy Sparkle distribution archive | ||
run: | | ||
cp ~/Library/Developer/Xcode/DerivedData/M1necraft-*/SourcePackages/artifacts/sparkle . | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build_artifacts | ||
path: ${{ github.workspace }}/M1necraft.app.zip | ||
retention-days: 1 | ||
- name: Upload Sparkle tools | ||
with: | ||
name: sparkle_updater | ||
path: ${{ github.workspace }}/sparkle | ||
retention-days: 1 | ||
release: | ||
needs: build | ||
runs-on: macos-latest | ||
|
@@ -45,6 +56,36 @@ jobs: | |
with: | ||
files: ${{ github.workspace }}/M1necraft.app.zip | ||
generate_release_notes: true | ||
update-appcast: | ||
needs: [build, release] | ||
runs-on: macos-latest | ||
env: | ||
APPCAST_WORKDIR: ${{ github.workspace }}/appcast | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create $APPCAST_WORKDIR directory | ||
run: mkdir $APPCAST_WORKDIR | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: sparkle_updater | ||
path: ${{ env.APPCAST_WORKDIR }} | ||
- name: Import Sparkle keys | ||
working-directory: ${{ env.APPCAST_WORKDIR }} | ||
env: | ||
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }} | ||
run: echo "$SPARKLE_PRIVATE_KEY" | ./bin/generate_keys -f /dev/stdin | ||
- name: Generate Appcast | ||
working-directory: ${{ env.APPCAST_WORKDIR }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | ||
run: | | ||
pip install -r requirements.txt | ||
${{ github.workspace }}/scripts/update_appcast | ||
- name: Publish Appcast | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: ${{ env.APPCAST_WORKDIR }} | ||
bump-homebrew-cask: | ||
runs-on: macos-latest | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// AppUpdaterView.swift | ||
// M1necraft | ||
// | ||
// Created by Raphael Tang on 6/5/22. | ||
// | ||
|
||
import SwiftUI | ||
import Sparkle | ||
|
||
final class UpdaterViewModel: ObservableObject { | ||
private let updaterController: SPUStandardUpdaterController | ||
|
||
@Published var canCheckForUpdates = false | ||
|
||
init() { | ||
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil) | ||
updaterController.updater.publisher(for: \.canCheckForUpdates).assign(to: &$canCheckForUpdates) | ||
} | ||
|
||
func checkForUpdates() { | ||
updaterController.checkForUpdates(nil) | ||
} | ||
} | ||
|
||
struct AppUpdaterView: View { | ||
@ObservedObject var updater: UpdaterViewModel | ||
|
||
var body: some View { | ||
Button("Check for Updates...", action: updater.checkForUpdates) | ||
.disabled(!updater.canCheckForUpdates) | ||
} | ||
} | ||
|
||
struct AppUpdaterView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AppUpdaterView(updater: UpdaterViewModel()) | ||
} | ||
} |
Oops, something went wrong.