Skip to content

Commit

Permalink
Add prepare script for Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Mar 17, 2022
1 parent 067c641 commit d5273b1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ yarn.lock
distribution
.cache
.parcel-cache
LocalOverrides.xcconfig
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"build": "parcel build source/manifest.json --dist-dir distribution --no-cache --no-content-hash --no-source-maps --detailed-report 0",
"lint": "xo",
"pack:safari": "xcodebuild -project 'safari/GhostText.xcodeproj'",
"prepare:safari": "bash safari/prepare-release.sh",
"start:safari": "open 'safari/build/Release/GhostText.app'",
"test": "xo && npm run build",
"watch": "parcel watch source/manifest.json --dist-dir distribution --no-cache --no-hmr"
Expand Down
6 changes: 4 additions & 2 deletions safari/Shared.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
MARKETING_VERSION = 21.2.4
CURRENT_PROJECT_VERSION = 2
MARKETING_VERSION = 0.0.0
CURRENT_PROJECT_VERSION = 1

#include? "LocalOverrides.xcconfig"
29 changes: 29 additions & 0 deletions safari/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash

# Automatically exit on error
set -e

CONFIG_FILE=./safari/LocalOverrides.xcconfig

TAG=$(git describe --tags --abbrev=0)

if [[ $(git describe --tags) != "$TAG" ]]; then
echo You’re ahead of the latest tag. Run:
echo git checkout "$TAG"
exit 1
fi

PROJECT_VERSION=$(sed -n 's/^CURRENT_PROJECT_VERSION = \(.*\)/\1/p' < $CONFIG_FILE)
NEXT_PROJECT_VERSION=$((PROJECT_VERSION + 1))

echo "Will bump the project version" "$PROJECT_VERSION"

trash distribution
npm run build
npx dot-json distribution/manifest.json version "$TAG"

sed -i '' '/MARKETING_VERSION/d' $CONFIG_FILE
sed -i '' '/CURRENT_PROJECT_VERSION/d' $CONFIG_FILE

echo "MARKETING_VERSION = $TAG" >> $CONFIG_FILE
echo "CURRENT_PROJECT_VERSION = $NEXT_PROJECT_VERSION" >> $CONFIG_FILE

0 comments on commit d5273b1

Please sign in to comment.