Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CLI release process #6

Merged
merged 4 commits into from
Nov 7, 2022
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
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