Skip to content

Commit

Permalink
Add step to precommit ensuring that local development is set to false…
Browse files Browse the repository at this point in the history
… in Package.swift, also required for when making releses.
  • Loading branch information
CyonAlexRDX committed Feb 19, 2024
1 parent 6a7efd4 commit 95931b9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ repos:
- id: typos
- repo: local
hooks:
- id: ensure Swift not changed to local development
name: ensure Swift not changed to local development
language: system
types: [file, swift]
entry: ./scripts/ios/ensure-not-local.sh
pass_filenames: false

- id: fmt
name: fmt
language: system
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription

let sargonBinaryTargetName = "SargonCoreRS"
let binaryTarget: Target
let useLocalFramework = true
let useLocalFramework = false

if useLocalFramework {
binaryTarget = .binaryTarget(
Expand Down
11 changes: 11 additions & 0 deletions scripts/ios/ensure-not-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env zsh

set -e
set -u

if grep -q "let useLocalFramework = true" Package.swift; then
echo "You MUST let useLocalFramework be set to 'false'. Else Swift release will fail."
exit 1;
fi

exit 0;
3 changes: 1 addition & 2 deletions scripts/ios/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ echo "🚢 Start of '$me' (see: '$DIR/$me')"
echo "🚢 PWD: $PWD"

echo "🚢 Ensure 'useLocalFramework' is set to 'false' in Package.swift"
sed -i '' 's/let useLocalFramework = true/let useLocalFramework = false/' Package.swift

sh ./scripts/ios/ensure-not-local.sh || exit $?

`git fetch --prune --tags`
function last_tag() {
Expand Down

0 comments on commit 95931b9

Please sign in to comment.