-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from thierrymarianne/add-release-github-action…
…s-workflow Add scripts to build and publish windows archive containing newly compiled binary on tag push
- Loading branch information
Showing
8 changed files
with
135 additions
and
75 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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
#!/bin/bash | ||
|
||
function build() { | ||
cd "${GITHUB_WORKSPACE}" || exit | ||
cargo build --release --features jemalloc --target=x86_64-unknown-linux-musl | ||
|
||
mkdir "${GITHUB_WORKSPACE}/bin" | ||
|
||
cp "${GITHUB_WORKSPACE}/target/x86_64-unknown-linux-musl/release/packetcrypt" \ | ||
"${GITHUB_WORKSPACE}"'/'"${RELEASE_NAME}" | ||
} | ||
build |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
#!/bin/bash | ||
|
||
function build() { | ||
cd "${GITHUB_WORKSPACE}" || exit | ||
cargo build --release --target x86_64-pc-windows-gnu | ||
|
||
mkdir ./bin | ||
|
||
mv ./target/x86_64-pc-windows-gnu/release/packetcrypt.exe ./bin | ||
|
||
zip -r "./${RELEASE_NAME}-win.zip" ./bin | ||
} | ||
build |
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,54 @@ | ||
|
||
function publish() { | ||
local archive | ||
archive="${1}" | ||
|
||
local extension | ||
extension="${2}" | ||
|
||
if [ ! -e "${archive}" ]; | ||
then | ||
echo 'Invalid archive ('"${archive}"')' | ||
return 1 | ||
fi | ||
|
||
local checksum | ||
checksum="$(sha256sum "${archive}" | cut -d ' ' -f 1)" | ||
|
||
local base_url | ||
base_url='https://api.github.com/repos/'"${GITHUB_REPOSITORY}" | ||
|
||
local upload_url | ||
upload_url="$(curl \ | ||
-H 'Content-Type: application/octet-stream' \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
"${base_url}"/releases 2>> /dev/null | \ | ||
jq -r '.[] | .upload_url' | \ | ||
head -n1)" | ||
|
||
upload_url=${upload_url/\{?name,label\}/} | ||
|
||
local release_name | ||
release_name="$(curl \ | ||
-H 'Content-Type: application/octet-stream' \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
"${base_url}"/releases 2>> /dev/null | \ | ||
jq -r '.[] | .tag_name' | \ | ||
head -n1)" | ||
|
||
curl \ | ||
-X POST \ | ||
--data-binary @${archive} \ | ||
-H 'Content-Type: application/octet-stream' \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
"${upload_url}?name=${release_name}-windows${extension}" | ||
|
||
curl \ | ||
-X POST \ | ||
--data "$checksum" \ | ||
-H 'Content-Type: text/plain' \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
"${upload_url}?name=${release_name}-windows${extension}.sha256sum" | ||
} | ||
|
||
publish "${GITHUB_WORKSPACE}"'/'"${RELEASE_NAME}"'-win.zip' '.zip' |
This file was deleted.
Oops, something went wrong.