mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
Create script to create SPM artifact bundle (#1215)
This commit is contained in:
committed by
Nick Lockwood
parent
378543f07b
commit
c58df8066d
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
REGEX="let swiftFormatVersion = \"([0-9]+.[0-9]+.[0-9]+)\""
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ $REGEX ]]
|
||||
then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
break
|
||||
fi
|
||||
done < Sources/SwiftFormat.swift
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ARTIFACT_BUNDLE=swiftformat.artifactbundle
|
||||
INFO_TEMPLATE=Scripts/spm-macos-artifact-bundle-info.template
|
||||
VERSION=$(./Scripts/get-version.sh)
|
||||
BINARY_OUTPUT_DIR=$ARTIFACT_BUNDLE/swiftformat-$VERSION-macos/bin
|
||||
|
||||
mkdir $ARTIFACT_BUNDLE
|
||||
|
||||
# Copy license into bundle
|
||||
cp LICENSE.md $ARTIFACT_BUNDLE
|
||||
|
||||
# Create bundle info.json from template, replacing version
|
||||
sed 's/__VERSION__/'"${VERSION}"'/g' $INFO_TEMPLATE > "${ARTIFACT_BUNDLE}/info.json"
|
||||
|
||||
# Copy MacOS SwiftFormat binary into bundle
|
||||
mkdir -p $BINARY_OUTPUT_DIR
|
||||
cp CommandLineTool/swiftformat $BINARY_OUTPUT_DIR
|
||||
|
||||
# Create ZIP
|
||||
zip -yr - $ARTIFACT_BUNDLE > "${ARTIFACT_BUNDLE}.zip"
|
||||
|
||||
rm -rf $ARTIFACT_BUNDLE
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schemaVersion": "1.0",
|
||||
"artifacts": {
|
||||
"swiftformat": {
|
||||
"version": "__VERSION__",
|
||||
"type": "executable",
|
||||
"variants": [
|
||||
{
|
||||
"path": "swiftformat-__VERSION__-macos/bin/swiftformat",
|
||||
"supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user