Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
runs-on: macos-26
steps:
- uses: actions/checkout@v7
with:
# scripts/version.sh counts every commit for the build number.
fetch-depth: 0

- name: Show toolchain
run: swift --version
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
RELEASING: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v7
with:
# scripts/version.sh counts every commit for the build number.
fetch-depth: 0

- name: Derive the version from the tag
if: env.RELEASING == 'true'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ __pycache__/
ios/build/
*.xcworkspace/xcuserdata/
ios/Local.xcconfig
ios/Version.xcconfig
3 changes: 2 additions & 1 deletion docs/specs/library-manager/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ library listing. Field Guide reads two of them for deities' lore.
16.3 Both channels carry a privacy manifest (`PrivacyInfo.xcprivacy`) that declares no tracking and no collected
data, and the two required-reason APIs the app uses: user defaults (`CA92.1`) and file timestamps (`C617.1`).
16.4 Both declare `ITSAppUsesNonExemptEncryption` as false, a copyright line, and the real version; the build number
(`BUILD_NUMBER`) is separate from the version and increases with every upload.
(`BUILD_NUMBER`) is separate from the version: it is the number of commits on main
(scripts/version.sh), the same on the Mac and the iPad, so it increases with every merge and every upload.
16.5 The App Store build's entitlements leave out the Downloads folder, which only the updater used; the sandbox,
network client, chosen download folder, its bookmark and the App Group remain, each with a use to name in review.
16.6 `PRIVACY.md` is the privacy policy, linked from the Help menu on the Mac and from About on both platforms.
4 changes: 0 additions & 4 deletions ios/Scrollkeeper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Scrollkeeper.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Scrollkeeper;
Expand All @@ -267,7 +266,6 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.0;
PRODUCT_NAME = "Scrollkeeper";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand All @@ -284,7 +282,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Scrollkeeper.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Scrollkeeper;
Expand All @@ -299,7 +296,6 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.0;
PRODUCT_NAME = "Scrollkeeper";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme LastUpgradeVersion = "2600" version = "1.7">
<BuildAction parallelizeBuildables = "YES" buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent title = "Version from git" scriptText = "# Writes the version and build number from git, so every build (Product &gt; Archive included) carries them.&#10;cd &quot;$PROJECT_DIR/..&quot; &amp;&amp; scripts/version.sh xcconfig &gt; ios/Version.xcconfig&#10;">
<EnvironmentBuildable>
<BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "A10000000000000000000006" BuildableName = "Scrollkeeper.app" BlueprintName = "Scrollkeeper-iPad" ReferencedContainer = "container:Scrollkeeper.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES">
<BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "A10000000000000000000006" BuildableName = "Scrollkeeper.app" BlueprintName = "Scrollkeeper-iPad" ReferencedContainer = "container:Scrollkeeper.xcodeproj">
Expand Down
9 changes: 8 additions & 1 deletion ios/Signing.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Signing settings for the iPad app.
// Signing and version settings for the iPad app.
//
// Put your own Apple developer team in Local.xcconfig next to this file. That file is not
// committed, so nobody's team ends up in the repository:
Expand All @@ -11,4 +11,11 @@
DEVELOPMENT_TEAM =
PRODUCT_BUNDLE_IDENTIFIER = io.github.scooper4711.Scrollkeeper

// The version and build number come from git (scripts/version.sh): the Scrollkeeper-iPad scheme's build
// pre-action writes them to Version.xcconfig before every build, Product > Archive included. These are the
// fallbacks for a build that skips the scheme.
MARKETING_VERSION = 0.0.0
CURRENT_PROJECT_VERSION = 1
#include? "Version.xcconfig"

#include? "Local.xcconfig"
11 changes: 6 additions & 5 deletions scripts/build-app.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/bin/sh
# Builds "build/Scrollkeeper.app" from the Swift package.
#
# VERSION version written to the bundle (default 0.0.0)
# VERSION version written to the bundle (default: scripts/version.sh marketing)
# UNIVERSAL set to 1 to build for both Apple silicon and Intel
# TEAM_ID the team that owns the App Group (default: read from the Developer ID certificate)
# SIGNING_IDENTITY passed to scripts/sign-app.sh; "-" signs ad hoc, without the App Group
# CHANNEL "appstore" builds the Mac App Store package (build/appstore/Scrollkeeper.pkg) from the same sources,
# compiled with -DAPP_STORE so the updater and the Ko-fi link are left out; needs BUILD_NUMBER, TEAM_ID
# and the variables of tabletop-kit's scripts/package-appstore.sh (TRIAL=1 checks it without them)
# BUILD_NUMBER CFBundleVersion, which must increase with every upload (default: VERSION)
# BUILD_NUMBER CFBundleVersion, which must increase with every upload (default: scripts/version.sh build)
set -eu

cd "$(dirname "$0")/.."

VERSION="${VERSION:-0.0.0}"
VERSION="${VERSION:-$(scripts/version.sh marketing)}"
BUILD_NUMBER="${BUILD_NUMBER:-$(scripts/version.sh build)}"
APP="build/Scrollkeeper.app"
EXECUTABLE="Scrollkeeper"

Expand Down Expand Up @@ -101,7 +102,7 @@ cat > "$APP/Contents/Info.plist" <<PLIST
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER:-$VERSION}</string>
<string>$BUILD_NUMBER</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down Expand Up @@ -136,7 +137,7 @@ if [ "${CHANNEL:-}" = "appstore" ]; then
/usr/libexec/PlistBuddy -c "Delete :com.apple.security.files.downloads.read-write" "$ENTITLEMENTS"
fi
scripts/sign-app.sh "$APP" "$ENTITLEMENTS"
echo "Built $APP ($VERSION)"
echo "Built $APP ($VERSION, build $BUILD_NUMBER)"

if [ "${CHANNEL:-}" = "appstore" ]; then
# The App Store build has no updater and no outside payment link (guidelines 2.4.5(vii) and 3.1.1).
Expand Down
34 changes: 34 additions & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
# Prints the app's version, taken from git so the iPad and Mac builds agree.
#
# scripts/version.sh marketing the newest release tag without its "v" (1.2.0), or 0.0.0 before the first
# scripts/version.sh build the build number: the commit count, which grows with every commit on main
# scripts/version.sh xcconfig both, as Xcode build settings (written to ios/Version.xcconfig)
set -eu

cd "$(dirname "$0")/.."

marketing() {
tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || echo v0.0.0)"
echo "${tag#v}"
}

build() {
# A shallow clone counts only the commits it fetched, which would make a build number go backwards.
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
echo "Reading the build number failed: the clone is shallow; fetch the full history." >&2
exit 1
fi
git rev-list --count HEAD
}

case "${1:-}" in
marketing) marketing ;;
build) build ;;
xcconfig)
echo "// Written by scripts/version.sh; not committed."
echo "MARKETING_VERSION = $(marketing)"
echo "CURRENT_PROJECT_VERSION = $(build)"
;;
*) echo "Usage: scripts/version.sh marketing|build|xcconfig" >&2; exit 2 ;;
esac
Loading