Skip to content

Commit

Permalink
Merge pull request #6 from mackoj/feat/improveBuildingProcess
Browse files Browse the repository at this point in the history
Improve CLI release process
  • Loading branch information
mackoj committed Nov 7, 2022
2 parents 207a9e3 + 743de6c commit b1d151b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ OPTIONS:
--verbose
-h, --help Show help information.
```

## Release process

Create a Github release
Publish Github release
Run the `./build.sh` to create the artifactbundle
Upload the `artifactbundle` to the corresponding release page
Update [checksum](https://github.com/mackoj/PackageGeneratorPlugin/blob/2d2eb7e7c63a898bd71b14de8cd5acaab36eb7d2/Package.swift#L18) in https://github.com/mackoj/PackageGeneratorPlugin.
35 changes: 32 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
#!/usr/bin/env bash

CLI="package-generator-cli"
INFOJSONPATH="$CLI.artifactbundle/info.json"
CLIBINPATH="$CLI.artifactbundle/arm64-apple-macosx/bin"
TMPPATH=$(mktemp)
TMPRELEASEFOLDER=$(mktemp -d)
TMPRELEASEPROJECT=$TMPRELEASEFOLDER/PackageGeneratorCLI
TAG=$(curl -s "https://api.github.com/repos/mackoj/PackageGeneratorCLI/tags" | jq --compact-output --raw-output '.[0].name ')
SOURCEFOLDER=$(pwd)

cd "$TMPRELEASEFOLDER" || exit
git clone --depth 1 --branch "$TAG" https://github.com/mackoj/PackageGeneratorCLI.git
cd "$TMPRELEASEPROJECT" || exit

echo "Building $TAG"
git checkout "$TAG"

echo "Building $TAG"
swift build -c release
mkdir -p $CLI.artifactbundle/arm64-apple-macosx/bin
cp -f .build/release/$CLI $CLI.artifactbundle/arm64-apple-macosx/bin
cp info.json $CLI.artifactbundle/info.json

echo "Creating Artifactbundle"
mkdir -p $CLIBINPATH
cp -f .build/release/$CLI $CLIBINPATH
cp info.json "$INFOJSONPATH"
jq '.artifacts."package-generator-cli".version = "'"$TAG"'"' "$INFOJSONPATH" > "$TMPPATH"
mv "$TMPPATH" "$INFOJSONPATH"

echo "Zip Artifactbundle"
zip -r $CLI.artifactbundle.zip $CLI.artifactbundle -x ".*" -x "__MACOSX"

echo "Compute Checksum"
swift package compute-checksum $CLI.artifactbundle.zip

echo "Cleaning"
rm -rf $CLI.artifactbundle
cp $CLI.artifactbundle.zip "$SOURCEFOLDER/$CLI.artifactbundle.zip"
cd "$SOURCEFOLDER" || exit
rm -rf "$TMPRELEASEFOLDER"
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"path": "arm64-apple-macosx/bin/package-generator-cli",
"supportedTriples": ["arm64-apple-macosx"]
},
}
]
}
}
Expand Down

0 comments on commit b1d151b

Please sign in to comment.