Skip to content

Commit

Permalink
Store archives in separate build artifacts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lslqtz committed Jan 28, 2024
1 parent f572e7b commit 554db07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ inputs:
outputs:
release_asset_dir:
description: 'Release file directory provided for use by other workflows'
release_asset_archive_dir:
description: 'Release file archive directory provided for use by other workflows'
release_asset_file:
description: 'Release file name provided for use by other workflows'
release_asset_path:
Expand Down
7 changes: 5 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ fi

# build
BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s)
BUILD_ARTIFACTS_ARCHIVE_FOLDER="archive_${BUILD_ARTIFACTS_FOLDER}"
mkdir -p ${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER}
mkdir -p ${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_ARCHIVE_FOLDER}
cd ${INPUT_PROJECT_PATH}
if [[ "${INPUT_BUILD_COMMAND}" =~ ^make.* ]]; then
# start with make, assumes using make to build golang binaries, execute it directly
Expand Down Expand Up @@ -142,9 +144,9 @@ if [ ${INPUT_COMPRESS_ASSETS^^} == "TRUE" ] || [ ${INPUT_COMPRESS_ASSETS^^} == "
RELEASE_ASSET_EXT='.zip'
MEDIA_TYPE='application/zip'
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
( shopt -s dotglob; zip -vr ${RELEASE_ASSET_FILE} * )
( shopt -s dotglob; zip -vr "../${BUILD_ARTIFACTS_ARCHIVE_FOLDER}/${RELEASE_ASSET_FILE}" * )
else
( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * )
( shopt -s dotglob; tar cvfz "../${BUILD_ARTIFACTS_ARCHIVE_FOLDER}/${RELEASE_ASSET_FILE}" * )
fi
elif [ ${INPUT_COMPRESS_ASSETS^^} == "OFF" ] || [ ${INPUT_COMPRESS_ASSETS^^} == "FALSE" ]; then
RELEASE_ASSET_EXT=${EXT}
Expand Down Expand Up @@ -189,5 +191,6 @@ fi

# output path for use by other workflows (e.g.: actions/upload-artifact)
echo "release_asset_dir=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER}" >> "${GITHUB_OUTPUT}"
echo "release_asset_archive_dir=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_ARCHIVE_FOLDER}" >> "${GITHUB_OUTPUT}"
echo "release_asset_file=${RELEASE_ASSET_FILE}" >> "${GITHUB_OUTPUT}"
echo "release_asset_path=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER}/${RELEASE_ASSET_FILE}" >> "${GITHUB_OUTPUT}"

0 comments on commit 554db07

Please sign in to comment.