-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate checksums during package (#679)
* Generate checksums during package Signed-off-by: Yael Harel <[email protected]> * Calculate the sha256 while writing to the file Signed-off-by: Yael Harel <[email protected]> * Add the sha256 artifacts to the release Signed-off-by: Yael Harel <[email protected]> * rename linux to linux-x86-64 in the build and release yml files Signed-off-by: Yael Harel <[email protected]> * Add a new line at the end of each sha file Signed-off-by: Yael Harel <[email protected]>
- Loading branch information
Showing
4 changed files
with
105 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
exit 1 | ||
fi | ||
echo "LIFECYCLE_VERSION=$version" >> $GITHUB_ENV | ||
- name: Determine download urls for linux and windows | ||
- name: Determine download urls for linux-x86-64 and windows | ||
id: artifact-urls | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -72,31 +72,49 @@ jobs: | |
.map(artifact => [artifact.name, artifact.archive_download_url]); | ||
let urlMap = new Map(); | ||
tuples.forEach(function(tuple) { | ||
if (tuple[0].includes("linux")) { | ||
urlMap.set("linux", tuple[1]) | ||
if (tuple[0].includes("linux-x86-64")) { | ||
if (tuple[0].includes("sha256")) { | ||
urlMap.set("linux_x86_64_sha256", tuple[1]) | ||
} else { | ||
urlMap.set("linux_x86_64", tuple[1]) | ||
} | ||
} | ||
if (tuple[0].includes("windows")) { | ||
urlMap.set("windows", tuple[1]) | ||
if (tuple[0].includes("sha256")) { | ||
urlMap.set("windows_sha256", tuple[1]) | ||
} else { | ||
urlMap.set("windows", tuple[1]) | ||
} | ||
} | ||
}) | ||
if (urlMap.size === 0) { | ||
throw "no artifacts found" | ||
} | ||
if (urlMap.size != 2) { | ||
throw "there should be exactly two artifacts" | ||
if (urlMap.size != 4) { | ||
throw "there should be exactly four artifacts" | ||
} | ||
return Object.fromEntries(urlMap.entries()) | ||
}) | ||
- name: Download linux artifact | ||
- name: Download linux-x86-64 artifact | ||
run: | | ||
url=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r .linux ) | ||
url=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r .linux_x86_64 ) | ||
curl -sL -w 'RESP_CODE:%{response_code}\n' \ | ||
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
-o artifact-linux.zip $url | ||
mkdir artifact-linux | ||
unzip -d artifact-linux artifact-linux.zip | ||
lifecycle_path=$(ls artifact-linux/lifecycle-*linux.x86-64.tgz) | ||
echo "ARTIFACT_LINUX_PATH=$PWD/$lifecycle_path" >> $GITHUB_ENV | ||
-o artifact-linux-x86-64.zip $url | ||
mkdir artifact-linux-x86-64 | ||
unzip -d artifact-linux-x86-64 artifact-linux-x86-64.zip | ||
lifecycle_path=$(ls artifact-linux-x86-64/lifecycle-*linux.x86-64.tgz) | ||
echo "ARTIFACT_LINUX_X86_64_PATH=$PWD/$lifecycle_path" >> $GITHUB_ENV | ||
- name: Download linux-x86-64-sha256 artifact | ||
run: | | ||
url=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r .linux_x86_64_sha256 ) | ||
curl -sL -w 'RESP_CODE:%{response_code}\n' \ | ||
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
-o artifact-linux-x86-64-sha256.zip $url | ||
mkdir artifact-linux-x86-64-sha256 | ||
unzip -d artifact-linux-x86-64-sha256 artifact-linux-x86-64-sha256.zip | ||
lifecycle_path=$(ls artifact-linux-x86-64-sha256/lifecycle-*linux.x86-64.tgz.sha256) | ||
echo "ARTIFACT_LINUX_X86_64_SHA_PATH=$PWD/$lifecycle_path" >> $GITHUB_ENV | ||
- name: Download windows artifact | ||
run: | | ||
url=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r .windows ) | ||
|
@@ -107,6 +125,16 @@ jobs: | |
unzip -d artifact-windows artifact-windows.zip | ||
lifecycle_path=$(ls artifact-windows/lifecycle-*windows.x86-64.tgz) | ||
echo "ARTIFACT_WINDOWS_PATH=$PWD/$lifecycle_path" >> $GITHUB_ENV | ||
- name: Download windows-sha256 artifact | ||
run: | | ||
url=$(echo '${{ steps.artifact-urls.outputs.result }}' | jq -r .windows_sha256 ) | ||
curl -sL -w 'RESP_CODE:%{response_code}\n' \ | ||
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
-o artifact-windows-sha256.zip $url | ||
mkdir artifact-windows-sha256 | ||
unzip -d artifact-windows-sha256 artifact-windows-sha256.zip | ||
lifecycle_path=$(ls artifact-windows-sha256/lifecycle-*windows.x86-64.tgz.sha256) | ||
echo "ARTIFACT_WINDOWS_SHA_PATH=$PWD/$lifecycle_path" >> $GITHUB_ENV | ||
- name: Set pre-release kind | ||
if: contains(env.LIFECYCLE_VERSION, 'rc') # e.g., 0.99.0-rc.1 | ||
run: | | ||
|
@@ -138,7 +166,8 @@ jobs: | |
if: contains(env.LIFECYCLE_VERSION, 'rc') # e.g., 0.99.0-rc.1 | ||
run: | | ||
gh release create v${{ env.LIFECYCLE_VERSION }} \ | ||
${{ env.ARTIFACT_LINUX_PATH }} ${{ env.ARTIFACT_WINDOWS_PATH }} \ | ||
${{ env.ARTIFACT_LINUX_X86_64_PATH }} ${{ env.ARTIFACT_LINUX_X86_64_SHA_PATH }} \ | ||
${{ env.ARTIFACT_WINDOWS_PATH }} ${{ env.ARTIFACT_WINDOWS_SHA_PATH }} \ | ||
--draft \ | ||
--notes-file body.txt \ | ||
--prerelease \ | ||
|
@@ -150,7 +179,8 @@ jobs: | |
if: "!contains(env.LIFECYCLE_VERSION, 'rc')" | ||
run: | | ||
gh release create v${{ env.LIFECYCLE_VERSION }} \ | ||
${{ env.ARTIFACT_LINUX_PATH }} ${{ env.ARTIFACT_WINDOWS_PATH }} \ | ||
${{ env.ARTIFACT_LINUX_X86_64_PATH }} ${{ env.ARTIFACT_LINUX_X86_64_SHA_PATH }} \ | ||
${{ env.ARTIFACT_WINDOWS_PATH }} ${{ env.ARTIFACT_WINDOWS_SHA_PATH }} \ | ||
--draft \ | ||
--notes-file body.txt \ | ||
--target $GITHUB_REF \ | ||
|
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