-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added two agent packages (msi and pkg) to install agent binary …
…to windows and macOS via local package manager
- Loading branch information
Showing
27 changed files
with
752 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: VXAgent installer build | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
build_installer_osx: | ||
name: Installer build | ||
environment: | ||
name: production | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: agent_osx | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: decode_environment | ||
- name: prepare files | ||
run: | | ||
mkdir build/package/agent/_tmp | ||
cp -r agent/_tmp/* build/package/agent/_tmp | ||
ls -R build/package/agent/_tmp | ||
shell: bash | ||
- name: Build macOS installer | ||
run: | | ||
cd build/package/agent | ||
chmod +x build-install-osx.sh | ||
VERSION=$(cat _tmp/version) ./build-install-osx.sh | ||
cp install_osx/vxagent-*_amd64.pkg _tmp/darwin/amd64/vxagent.pkg | ||
- name: Upload result for pkg installer | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent_pkg | ||
path: | | ||
build/package/agent/install_osx/*.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: VXAgent installer build | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
build_installer_windows: | ||
name: Installer build | ||
environment: | ||
name: production | ||
runs-on: windows-2019 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: agent_windows | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: decode_environment | ||
- name: prepare files | ||
run: | | ||
mkdir build/package/agent/_tmp | ||
cp -r agent/_tmp/* build/package/agent/_tmp | ||
ls -R build/package/agent/_tmp | ||
shell: bash | ||
- name: Set path for heat.exe and light.exe | ||
run: echo "$WIX\\bin" >>$GITHUB_PATH | ||
shell: bash | ||
- name: Build Windows installer | ||
run: | | ||
cd build/package/agent | ||
pwsh -ExecutionPolicy Bypass -File build.ps1 packages.json vxagent | ||
mkdir install_windows | ||
cp dist/*.msi install_windows/ | ||
- name: Upload result for msi installer | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent_msi | ||
path: | | ||
build/package/agent/install_windows/*.msi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
TARGET_DIRECTORY="target" | ||
PRODUCT="vxagent" | ||
OUTPUT_PATH="install_osx" | ||
export VERSION=${VERSION/v/} | ||
export VERSION=${VERSION%-*} | ||
|
||
|
||
log_info() { | ||
echo "${LOG_PREFIX}[INFO]" $1 | ||
} | ||
|
||
log_warn() { | ||
echo "${LOG_PREFIX}[WARN]" $1 | ||
} | ||
|
||
log_error() { | ||
echo "${LOG_PREFIX}[ERROR]" $1 | ||
} | ||
|
||
deleteInstallationDirectory() { | ||
log_info "Cleaning $TARGET_DIRECTORY directory." | ||
rm -rf $TARGET_DIRECTORY | ||
|
||
if [[ $? != 0 ]]; then | ||
log_error "Failed to clean $TARGET_DIRECTORY directory" $? | ||
exit 1 | ||
fi | ||
} | ||
|
||
createInstallationDirectory() { | ||
if [ -d ${TARGET_DIRECTORY} ]; then | ||
deleteInstallationDirectory | ||
fi | ||
mkdir -p $TARGET_DIRECTORY | ||
|
||
if [[ $? != 0 ]]; then | ||
log_error "Failed to create $TARGET_DIRECTORY directory" $? | ||
exit 1 | ||
fi | ||
} | ||
|
||
deleteOutputPath() { | ||
log_info "Cleaning ${OUTPUT_PATH} directory." | ||
rm -rf ${OUTPUT_PATH} | ||
|
||
if [[ $? != 0 ]]; then | ||
log_error "Failed to clean ${OUTPUT_PATH} directory" $? | ||
exit 1 | ||
fi | ||
} | ||
|
||
createOutputPath() { | ||
if [ -d ${OUTPUT_PATH} ]; then | ||
deleteOutputPath | ||
fi | ||
mkdir -p ${OUTPUT_PATH} | ||
|
||
if [[ $? != 0 ]]; then | ||
log_error "Failed to create $TARGET_DIRECTORY directory" $? | ||
exit 1 | ||
fi | ||
|
||
} | ||
|
||
copyDarwinDirectory() { | ||
createInstallationDirectory | ||
createOutputPath | ||
cp -r darwin ${TARGET_DIRECTORY}/ | ||
chmod -R 755 ${TARGET_DIRECTORY}/darwin | ||
} | ||
|
||
copyBuildDirectory() { | ||
sed -i '' -e 's/__VERSION__/'${VERSION}'/g;s/__PRODUCT__/'${PRODUCT}'/g' ${TARGET_DIRECTORY}/darwin/scripts/postinstall | ||
sed -i '' -e 's/__VERSION__/'${VERSION}'/g;s/__PRODUCT__/'${PRODUCT}'/g' ${TARGET_DIRECTORY}/darwin/Distribution | ||
sed -i '' -e 's/__VERSION__/'${VERSION}'/g;s/__PRODUCT__/'${PRODUCT}'/g' ${TARGET_DIRECTORY}/darwin/Resources/*.html | ||
|
||
rm -rf ${TARGET_DIRECTORY}/darwinpkg | ||
mkdir -p ${TARGET_DIRECTORY}/darwinpkg | ||
|
||
#Copy product to /Library/PRODUCT | ||
mkdir -p ${TARGET_DIRECTORY}/darwinpkg/Library/${PRODUCT} | ||
log_info "Try signing executable file" | ||
cp -a _tmp/darwin/amd64/vxagent ${TARGET_DIRECTORY}/darwinpkg/Library/${PRODUCT} | ||
chmod -R 755 ${TARGET_DIRECTORY}/darwinpkg/Library/${PRODUCT} | ||
|
||
rm -rf ${TARGET_DIRECTORY}/package | ||
mkdir -p ${TARGET_DIRECTORY}/package | ||
chmod -R 755 ${TARGET_DIRECTORY}/package | ||
|
||
rm -rf ${TARGET_DIRECTORY}/pkg | ||
mkdir -p ${TARGET_DIRECTORY}/pkg | ||
chmod -R 755 ${TARGET_DIRECTORY}/pkg | ||
} | ||
|
||
function buildPackage() { | ||
log_info "Application installer package building started.(1/2)" | ||
pkgbuild --identifier org.${PRODUCT}.${VERSION} \ | ||
--version ${VERSION} \ | ||
--scripts ${TARGET_DIRECTORY}/darwin/scripts \ | ||
--root ${TARGET_DIRECTORY}/darwinpkg \ | ||
${TARGET_DIRECTORY}/package/${PRODUCT}.pkg >/dev/null 2>&1 | ||
} | ||
|
||
function buildProduct() { | ||
log_info "Application installer product building started.(2/2)" | ||
productbuild --distribution ${TARGET_DIRECTORY}/darwin/Distribution \ | ||
--resources ${TARGET_DIRECTORY}/darwin/Resources \ | ||
--package-path ${TARGET_DIRECTORY}/package \ | ||
${TARGET_DIRECTORY}/pkg/$1 >/dev/null 2>&1 | ||
} | ||
|
||
function createInstaller() { | ||
log_info "Application installer generation process started.(2 Steps)" | ||
buildPackage | ||
buildProduct ${PRODUCT}-${VERSION}_amd64.pkg | ||
mv ${TARGET_DIRECTORY}/pkg/${PRODUCT}-${VERSION}_amd64.pkg ${OUTPUT_PATH}/${PRODUCT}-${VERSION}_amd64.pkg | ||
log_info "Application installer generation steps finished." | ||
} | ||
|
||
function createUninstaller() { | ||
cp darwin/Resources/uninstall.sh ${TARGET_DIRECTORY}/darwinpkg/Library/${PRODUCT} | ||
sed -i '' -e "s/__VERSION__/${VERSION}/g;s/__PRODUCT__/${PRODUCT}/g" "${TARGET_DIRECTORY}/darwinpkg/Library/${PRODUCT}/uninstall.sh" | ||
} | ||
|
||
|
||
log_info "Installer generating process started." | ||
|
||
copyDarwinDirectory | ||
copyBuildDirectory | ||
createUninstaller | ||
createInstaller | ||
|
||
log_info "Installer generating process finished" | ||
exit 0 |
Oops, something went wrong.