Skip to content

Commit

Permalink
Merge pull request #4 from samcoe/update-release-process
Browse files Browse the repository at this point in the history
Update release process
  • Loading branch information
samcoe authored Aug 25, 2021
2 parents 7eef05d + 910fc99 commit d7df0a8
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 40 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
-
name: Upload artifacts
name: Update version
env:
GIT_COMMITTER_NAME: Actions Automation
GIT_COMMITTER_EMAIL:
GIT_AUTHOR_NAME: Actions Automation
GIT_AUTHOR_EMAIL:
run: |
git add dist
git restore --staged dist/config.yaml dist/\*.zip dist/\*.tar.gz dist/\*.txt dist/\*.txt.sig
git commit -m "Add artifacts for ${GITHUB_REF#refs/tags/}"
tag="${GITHUB_REF#refs/tags/}"
sed -i -e "s/^tag=.*/tag=\"${tag}\"/" gh-repo-explore
git add gh-repo-explore
git commit -m "Update version to ${tag}"
if [[ $GITHUB_REF != *-* ]]; then
git push origin HEAD:trunk
fi
6 changes: 2 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ builds:
- 386
- amd64
archives:
- wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
- format: binary
name_template: "{{ .Binary }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
checksum:
disable: false
signs:
Expand Down
Binary file removed dist/gh-repo-explore_darwin_amd64/gh-repo-explore
Binary file not shown.
Binary file removed dist/gh-repo-explore_linux_386/gh-repo-explore
Binary file not shown.
Binary file removed dist/gh-repo-explore_linux_amd64/gh-repo-explore
Binary file not shown.
Binary file removed dist/gh-repo-explore_windows_386/gh-repo-explore.exe
Binary file not shown.
Binary file not shown.
87 changes: 55 additions & 32 deletions gh-repo-explore
Original file line number Diff line number Diff line change
@@ -1,40 +1,63 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

extensionPath="$(dirname "$0")"
arch="$(uname -m)"
tag="v0.0.3"
repo="samcoe/gh-repo-explore"
extension_path="$(dirname "$0")"
tag_path="${extension_path}/dist/${tag}"
exe="gh-repo-explore"

if uname -a | grep Msys > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_amd64/gh-repo-explore" "$@"
elif [ $arch = "i686" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_386/gh-repo-explore" "$@"
elif [ $arch = "i386" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_386/gh-repo-explore" "$@"
determine_platform() {
local arch="$(uname -m)"
if uname -a | grep Msys > /dev/null; then
if [ $arch == "x86_64" ]; then
platform="windows_amd64"
elif [ $arch == "i686" ]; then
platform="windows_386"
elif [ $arch == "i386" ]; then
platform="windows_386"
fi
elif uname -a | grep Darwin > /dev/null; then
if [ $arch == "x86_64" ]; then
platform="darwin_amd64"
fi
elif uname -a | grep Linux > /dev/null; then
if [ $arch == "x86_64" ]; then
platform="linux_amd64"
elif [ $arch == "i686" ]; then
platform="linux_386"
elif [ $arch == "i386" ]; then
platform="linux_386"
fi
fi
elif uname -a | grep Darwin > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_darwin_amd64/gh-repo-explore" "$@"
fi
elif uname -a | grep Linux > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_amd64/gh-repo-explore" "$@"
elif [ $arch = "i686" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_386/gh-repo-explore" "$@"
elif [ $arch = "i386" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_386/gh-repo-explore" "$@"
fi
fi
}

if [ "$(which go)" = "" ]; then
echo "go must be installed to use this gh extension on this platform"
exit 1
fi
download_latest_release() {
mkdir -p "${tag_path}"
gh release -R"${repo}" download "${tag}" --pattern "*${platform}*" --dir="${tag_path}"
if [ $platform == "windows_amd64" ] || [ $platform == "windows_386" ]; then
mv "${tag_path}/${exe}_${tag}_${platform}.exe" "${tag_path}/${exe}"
else
mv "${tag_path}/${exe}_${tag}_${platform}" "${tag_path}/${exe}"
chmod +x "${tag_path}/${exe}"
fi
}

exe="cmd.out"
determine_platform

cd "${extensionPath}" > /dev/null
go build -o "${exe}"
cd - > /dev/null
if [ "${platform}" == "" ]; then
if [ "$(which go)" == "" ]; then
echo "go must be installed to use this gh extension on this platform"
exit 1
fi
mkdir -p "${tag_path}"
cd "${extensionPath}" > /dev/null
go build -o "${tag_path}/${exe}"
cd - > /dev/null
else
if [ ! -d tag_path ]; then
download_latest_release
fi
fi

exec "${extensionPath}/${exe}" "$@"
exec "${tag_path}/${exe}" "$@"

0 comments on commit d7df0a8

Please sign in to comment.