-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Dolev Hadar <6196971+dlvhdr@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
98 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
name: release | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: "The New Release" | ||
required: true | ||
|
||
env: | ||
RELEASE: ${{ github.event.inputs.release }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cli/gh-extension-precompile@v1 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2.1.4 | ||
with: | ||
go-version: "1.17.3" | ||
|
||
- name: Release | ||
run: | | ||
sudo chmod 755 ./release.sh | ||
./release.sh ${{ env.RELEASE }} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
debug.log | ||
dist |
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,55 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
repo="dlvhdr/gh-prs" | ||
|
||
extensionPath="$(dirname "$0")" | ||
arch="$(uname -m)" | ||
|
||
exe="" | ||
|
||
if uname -a | grep Msys > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="windows-x86_64" | ||
elif [ $arch = "i686" ]; then | ||
exe="windows-i386" | ||
elif [ $arch = "i386" ]; then | ||
exe="windows-i386" | ||
fi | ||
elif uname -a | grep Darwin > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="darwin-x86_64" | ||
elif [ $arch = "arm64" ]; then | ||
exe="darwin-arm64" | ||
fi | ||
elif uname -a | grep Linux > /dev/null; then | ||
if [ $arch = "x86_64" ]; then | ||
exe="linux-x86_64" | ||
elif [ $arch = "i686" ]; then | ||
exe="linux-i386" | ||
elif [ $arch = "i386" ]; then | ||
exe="linux-i386" | ||
fi | ||
fi | ||
|
||
if [ "${exe}" == "" ]; then | ||
if [ "$(which go)" = "" ]; then | ||
echo "go must be installed to use this gh extension on this platform" | ||
exit 1 | ||
fi | ||
|
||
exe="cmd.out" | ||
|
||
cd "${extensionPath}" > /dev/null | ||
go build -o "${exe}" | ||
cd - > /dev/null | ||
else | ||
if [[ ! -x "${extensionPath}/bin/${exe}" ]]; then | ||
mkdir -p bin | ||
rm -f "${extensionPath}/bin/*" | ||
gh release -R"${repo}" download -p "${exe}" --dir="${extensionPath}/bin" | ||
chmod +x "${extensionPath}/bin/${exe}" | ||
fi | ||
fi | ||
|
||
exec "${extensionPath}/bin/${exe}" "$@" |
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,21 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# TODO ARM support. figure out mapping to uname -m output. | ||
|
||
tag="${1}" | ||
|
||
if [ "${tag}" == "" ]; then | ||
echo "tag argument required" | ||
exit 1 | ||
fi | ||
|
||
rm -rf dist | ||
GOOS=darwin GOARCH=amd64 go build -o "dist/darwin-x86_64" | ||
GOOS=darwin GOARCH=arm64 go build -o "dist/darwin-arm64" | ||
GOOS=linux GOARCH=386 go build -o "dist/linux-i386" | ||
GOOS=linux GOARCH=amd64 go build -o "dist/linux-x86_64" | ||
GOOS=windows GOARCH=386 go build -o "dist/windows-i386" | ||
GOOS=windows GOARCH=amd64 go build -o "dist/windows-x86_64" | ||
|
||
gh release create $tag ./dist/* --title="${tag}" --notes "${tag}" |