Skip to content

Commit

Permalink
Merge pull request #72 from pbs/71/create_version_agnostic_artifact_f…
Browse files Browse the repository at this point in the history
…or_latest_release

Creating version agnostic artifact for latest release
  • Loading branch information
yhakbar authored Oct 6, 2022
2 parents 98f7655 + 7ffec03 commit 7fd811a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ Currently gorson ships binaries for MacOS and Linux 64bit systems. You can downl
## MacOS
```bash
wget https://github.com/pbs/gorson/releases/download/10/gorson-10-darwin-amd64
wget https://github.com/pbs/gorson/releases/latest/download/gorson-darwin-amd64
```
## Linux
Download the binary
```bash
wget https://github.com/pbs/gorson/releases/download/10/gorson-10-linux-amd64
wget https://github.com/pbs/gorson/releases/latest/download/gorson-linux-amd64
```
## ARM
Expand All @@ -117,7 +117,7 @@ Move the binary to an installation path, make it executable, and add to path
```bash
mkdir -p /opt/gorson/bin
mv gorson-10-linux-amd64 /opt/gorson/bin/gorson
mv gorson-linux-amd64 /opt/gorson/bin/gorson
chmod +x /opt/gorson/bin/gorson
export PATH="$PATH:/opt/gorson/bin"
```
Expand All @@ -141,13 +141,13 @@ asdf list-all gorson
Install a particular version
```bash
asdf install gorson 10
asdf install gorson 11
```
Make a particular version your default
```bash
asdf global gorson 10
asdf global gorson 11
```
# Notes
Expand Down
22 changes: 10 additions & 12 deletions scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@ IFS=$'\n\t'
# tooling logic borrowed heavily from the talented minds of confd
# https://github.com/kelseyhightower/confd/blob/master/Makefile

cd "$( dirname "${BASH_SOURCE[0]}" )/.."
cd "$(dirname "${BASH_SOURCE[0]}")/.."

./scripts/clean.sh
mkdir -p bin

VERSION=$(grep -E -o '[0-9]+' ./internal/gorson/version/version.go)

>&2 echo "building gorson_builder docker image"
echo >&2 "building gorson_builder docker image"
# build a local docker image called gorson_builder: we'll use this to
# compile our release binaries
docker build -t gorson_builder -f Dockerfile.build.alpine .

>&2 echo "compiling binaries for release"
echo >&2 "compiling binaries for release"
# for each of our target platforms we use the gorson_builder
# docker container to compile a binary of our application
for architecture in amd64 arm64; do
for platform in darwin linux; do
binary_name="gorson-${VERSION}-${platform}-${architecture}"
>&2 echo "compiling $binary_name"
binary_name="gorson-${platform}-${architecture}"
echo >&2 "compiling $binary_name"

# * GOOS is the target operating system
# * GOARCH is the target processor architecture
Expand All @@ -32,11 +30,11 @@ for architecture in amd64 arm64; do
# import C packages (we don't do this, so we set it to 0 to turn CGO off)
# see https://golang.org/cmd/cgo/
docker run --rm \
-v "${PWD}":/app \
-e "GOOS=${platform}" \
-e "GOARCH=${architecture}" \
-e "CGO_ENABLED=0" \
gorson_builder \
-v "${PWD}":/app \
-e "GOOS=${platform}" \
-e "GOARCH=${architecture}" \
-e "CGO_ENABLED=0" \
gorson_builder \
go build -o "bin/$binary_name"
done
done
10 changes: 4 additions & 6 deletions scripts/docker-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@ IFS=$'\n\t'
# tooling logic borrowed heavily from the talented minds of confd
# https://github.com/kelseyhightower/confd/blob/master/Makefile

cd "$( dirname "${BASH_SOURCE[0]}" )/.."
cd "$(dirname "${BASH_SOURCE[0]}")/.."

./scripts/clean.sh
mkdir -p bin

VERSION=$(grep -E -o '[0-9]+\.[0-9a-z.\-]+' ./internal/gorson/version/version.go)

# We want to make sure the final builds are formatted and linted properly.
./scripts/format.sh
./scripts/lint.sh

# for each of our target platforms we use the gorson_builder
# docker container to compile a binary of our application
>&2 echo "compiling binaries for release"
echo >&2 "compiling binaries for release"
for architecture in amd64 arm64; do
for platform in darwin linux; do
binary_name="gorson-${VERSION}-${platform}-${architecture}"
>&2 echo "compiling $binary_name"
binary_name="gorson-${platform}-${architecture}"
echo >&2 "compiling $binary_name"

# * GOOS is the target operating system
# * GOARCH is the target processor architecture
Expand Down

0 comments on commit 7fd811a

Please sign in to comment.