Skip to content

Commit e2975dd

Browse files
Prepare FileMint public release
0 parents  commit e2975dd

55 files changed

Lines changed: 2582 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
verify:
12+
name: Verify and build
13+
runs-on: macos-15
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Select Xcode
20+
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
21+
22+
- name: Install XcodeGen
23+
run: brew install xcodegen
24+
25+
- name: Check local toolchain
26+
run: make doctor
27+
28+
- name: Verify deterministic core behavior
29+
run: make verify
30+
31+
- name: Build unsigned app bundle
32+
run: make build

‎.github/workflows/release.yml‎

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Existing release tag, for example v0.1.0"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
17+
concurrency:
18+
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
19+
cancel-in-progress: false
20+
21+
jobs:
22+
release:
23+
name: Build, notarize, and publish
24+
runs-on: macos-15
25+
26+
env:
27+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
34+
35+
- name: Select Xcode
36+
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
37+
38+
- name: Install XcodeGen
39+
run: brew install xcodegen
40+
41+
- name: Check local toolchain
42+
run: make doctor
43+
44+
- name: Resolve release version
45+
id: version
46+
run: |
47+
set -euo pipefail
48+
TAG="$RELEASE_TAG"
49+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
50+
echo "::error::Release tag must look like v0.1.0."
51+
exit 2
52+
fi
53+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
54+
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
55+
56+
- name: Verify deterministic core behavior
57+
run: make verify
58+
59+
- name: Import Developer ID certificate
60+
env:
61+
CERTIFICATE_BASE64: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_BASE64 }}
62+
CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD }}
63+
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_BUILD_KEYCHAIN_PASSWORD }}
64+
run: |
65+
set -euo pipefail
66+
if [[ -z "$CERTIFICATE_BASE64" || -z "$CERTIFICATE_PASSWORD" || -z "$KEYCHAIN_PASSWORD" ]]; then
67+
echo "::error::Missing Developer ID certificate secrets."
68+
exit 2
69+
fi
70+
71+
CERTIFICATE_PATH="$RUNNER_TEMP/developer-id.p12"
72+
KEYCHAIN_PATH="$RUNNER_TEMP/filemint-signing.keychain-db"
73+
74+
echo "$CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
75+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
76+
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
77+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
78+
security import "$CERTIFICATE_PATH" -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
79+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
80+
security list-keychains -d user -s "$KEYCHAIN_PATH"
81+
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
82+
83+
- name: Package signed and notarized DMG
84+
id: package
85+
env:
86+
APP_VERSION: ${{ steps.version.outputs.version }}
87+
BUILD_NUMBER: ${{ github.run_number }}
88+
RELEASE_REQUIRE_SIGNING: "1"
89+
NOTARIZE: "1"
90+
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
91+
APPLE_ID: ${{ secrets.APPLE_ID }}
92+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
93+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
94+
run: ./scripts/package_release.sh
95+
96+
- name: Generate release notes
97+
id: notes
98+
env:
99+
GH_TOKEN: ${{ github.token }}
100+
TAG: ${{ steps.version.outputs.tag }}
101+
run: |
102+
set -euo pipefail
103+
NOTES_FILE="$RUNNER_TEMP/release-notes.md"
104+
gh api "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
105+
-f tag_name="$TAG" \
106+
--jq .body > "$NOTES_FILE"
107+
echo "notes_file=$NOTES_FILE" >> "$GITHUB_OUTPUT"
108+
109+
- name: Publish GitHub Release
110+
env:
111+
GH_TOKEN: ${{ github.token }}
112+
TAG: ${{ steps.version.outputs.tag }}
113+
TITLE: FileMint ${{ steps.version.outputs.version }}
114+
NOTES_FILE: ${{ steps.notes.outputs.notes_file }}
115+
DMG_PATH: ${{ steps.package.outputs.dmg_path }}
116+
CHECKSUM_PATH: ${{ steps.package.outputs.checksum_path }}
117+
run: |
118+
set -euo pipefail
119+
if gh release view "$TAG" >/dev/null 2>&1; then
120+
gh release upload "$TAG" "$DMG_PATH" "$CHECKSUM_PATH" --clobber
121+
gh release edit "$TAG" --title "$TITLE" --notes-file "$NOTES_FILE"
122+
else
123+
gh release create "$TAG" "$DMG_PATH" "$CHECKSUM_PATH" \
124+
--title "$TITLE" \
125+
--notes-file "$NOTES_FILE" \
126+
--verify-tag
127+
fi

‎.gitignore‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.DS_Store
2+
.build/
3+
build/
4+
DerivedData/
5+
FileMint.xcodeproj/
6+
*.xcworkspace/
7+
*.xcuserstate
8+
*.dmg
9+
*.app
10+
.local/
11+
12+
# Local agent and product-planning workspace. Do not publish these to GitHub.
13+
AGENTS.md
14+
specs/
15+
docs/AI_PLAYBOOK.md
16+
.agents/
17+
.codex/

‎App/FileMint/ContentView.swift‎

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
import FileMintCore
2+
import SwiftUI
3+
4+
private enum SettingsSection: String, CaseIterable, Identifiable {
5+
case status = "Status"
6+
case locations = "Locations"
7+
case templates = "Templates"
8+
case behavior = "Behavior"
9+
10+
var id: String { rawValue }
11+
}
12+
13+
struct ContentView: View {
14+
@EnvironmentObject private var model: PreferencesModel
15+
@State private var selection: SettingsSection? = .status
16+
17+
var body: some View {
18+
NavigationSplitView {
19+
List(SettingsSection.allCases, selection: $selection) { section in
20+
Text(section.rawValue)
21+
.tag(section)
22+
}
23+
.navigationSplitViewColumnWidth(min: 160, ideal: 180, max: 220)
24+
} detail: {
25+
detailView
26+
.padding(24)
27+
}
28+
}
29+
30+
@ViewBuilder
31+
private var detailView: some View {
32+
switch selection ?? .status {
33+
case .status:
34+
StatusPane()
35+
case .locations:
36+
LocationsPane()
37+
case .templates:
38+
TemplatesPane()
39+
case .behavior:
40+
BehaviorPane()
41+
}
42+
}
43+
}
44+
45+
private struct StatusPane: View {
46+
@EnvironmentObject private var model: PreferencesModel
47+
48+
var body: some View {
49+
Form {
50+
Section("Finder") {
51+
LabeledContent("Integration") {
52+
Text("Finder Sync Extension")
53+
}
54+
55+
Button("Open Extension Settings") {
56+
model.openExtensionSettings()
57+
}
58+
}
59+
60+
Section("Active Menu") {
61+
LabeledContent("Templates") {
62+
Text("\(model.enabledTemplates.count)")
63+
}
64+
65+
LabeledContent("Locations") {
66+
Text("\(model.preferences.monitoredFolderURLs.count)")
67+
}
68+
}
69+
70+
if let error = model.lastError {
71+
Section("Last Error") {
72+
Text(error)
73+
.foregroundStyle(.red)
74+
.textSelection(.enabled)
75+
}
76+
}
77+
}
78+
.formStyle(.grouped)
79+
.navigationTitle("FileMint")
80+
}
81+
}
82+
83+
private struct LocationsPane: View {
84+
@EnvironmentObject private var model: PreferencesModel
85+
86+
var body: some View {
87+
VStack(alignment: .leading, spacing: 16) {
88+
List {
89+
ForEach(model.preferences.monitoredFolderURLs, id: \.self) { url in
90+
Text(url.path)
91+
.lineLimit(1)
92+
.truncationMode(.middle)
93+
}
94+
.onDelete { offsets in
95+
model.removeMonitoredFolders(at: offsets)
96+
}
97+
}
98+
99+
HStack {
100+
Button("Add Folder") {
101+
model.addMonitoredFolder()
102+
}
103+
Spacer()
104+
}
105+
}
106+
.navigationTitle("Locations")
107+
}
108+
}
109+
110+
private struct TemplatesPane: View {
111+
@EnvironmentObject private var model: PreferencesModel
112+
113+
var body: some View {
114+
VStack(alignment: .leading, spacing: 16) {
115+
List {
116+
ForEach($model.preferences.templates) { $template in
117+
HStack {
118+
Toggle("", isOn: $template.isEnabled)
119+
.labelsHidden()
120+
.onChange(of: template.isEnabled) { _ in model.save() }
121+
122+
VStack(alignment: .leading, spacing: 2) {
123+
Text(template.displayName)
124+
Text(template.suggestedFileName)
125+
.foregroundStyle(.secondary)
126+
.font(.caption)
127+
}
128+
129+
Spacer()
130+
131+
Text(template.group)
132+
.foregroundStyle(.secondary)
133+
}
134+
.padding(.vertical, 4)
135+
}
136+
}
137+
138+
HStack {
139+
Button("Reset Built-ins") {
140+
model.resetTemplates()
141+
}
142+
Spacer()
143+
}
144+
}
145+
.navigationTitle("Templates")
146+
}
147+
}
148+
149+
private struct BehaviorPane: View {
150+
@EnvironmentObject private var model: PreferencesModel
151+
152+
var body: some View {
153+
Form {
154+
Section("Naming") {
155+
Picker("When File Exists", selection: $model.preferences.collisionStrategy) {
156+
Text("Auto Increment").tag(NameCollisionStrategy.increment)
157+
Text("Fail").tag(NameCollisionStrategy.fail)
158+
}
159+
.onChange(of: model.preferences.collisionStrategy) { _ in model.save() }
160+
}
161+
162+
Section("After Creation") {
163+
Toggle("Reveal Created File", isOn: $model.preferences.revealAfterCreation)
164+
.onChange(of: model.preferences.revealAfterCreation) { _ in model.save() }
165+
166+
Toggle("Favorites First", isOn: $model.preferences.favoritesFirst)
167+
.onChange(of: model.preferences.favoritesFirst) { _ in model.save() }
168+
}
169+
}
170+
.formStyle(.grouped)
171+
.navigationTitle("Behavior")
172+
}
173+
}

0 commit comments

Comments
 (0)