Skip to content

Commit

Permalink
Build & release arm64 binaries (oras-project#248)
Browse files Browse the repository at this point in the history
* Add build target for darwin arm64

* Include linux arm64 in make build

* Release arm64 binaries

Co-authored-by: Will Medlar <[email protected]>
  • Loading branch information
wmedlar and wmedlar authored Mar 18, 2021
1 parent ec34f51 commit 23f76e8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ builds:
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
ldflags:
# one-line ldflags to bypass the goreleaser bugs
# the git tree state is guaranteed to be clean by goreleaser
Expand All @@ -20,7 +24,7 @@ builds:
archives:
- format: tar.gz
files:
- LICENSE
- LICENSE

#signs:
# - artifacts: all
Expand Down
22 changes: 12 additions & 10 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ Mac:
# builds to bin/darwin/amd64/oras
make build-mac
```
Mac ARM64:

```bash
# builds to bin/darwin/arm64/oras
make build-mac-arm64
```

Linux:

Expand All @@ -27,14 +33,13 @@ Linux:
make build-linux
```

Linux ARM64:
Linux ARM64:

```bash
# builds to bin/linux/amd64/oras
make build-linux
# builds to bin/linux/arm64/oras
make build-linux-arm64
```


Windows:

```bash
Expand All @@ -60,9 +65,6 @@ git tag -a v0.1.0 -m "Release v0.1.0"
git push origin v0.1.0
```

A Codefresh pipeline will pick up the GitHub tag event
and run [.codefresh/release.yml](.codefresh/release.yml).

This will result in running [goreleaser](https://goreleaser.com/)
to upload release artiacts, as well as push a tag to Docker Hub for
the image `orasbot/oras`.
A [GitHub Actions pipeline](.github/workflows) will pick up the GitHub tag
event and run [goreleaser](https://goreleaser.com/) to upload release artiacts,
as well as push a tag to Docker Hub for the image `orasbot/oras`.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")

TARGET_OBJS ?= checksums.txt darwin_amd64.tar.gz linux_amd64.tar.gz windows_amd64.tar.gz
TARGET_OBJS ?= checksums.txt darwin_amd64.tar.gz darwin_arm64.tar.gz linux_amd64.tar.gz linux_arm64.tar.gz windows_amd64.tar.gz

LDFLAGS = -w
ifdef VERSION
Expand All @@ -30,7 +30,7 @@ clean:
git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf

.PHONY: build
build: build-linux build-linux-arm64 build-mac build-windows
build: build-linux build-linux-arm64 build-mac build-mac-arm64 build-windows

.PHONY: build-linux
build-linux:
Expand All @@ -47,6 +47,11 @@ build-mac:
GOARCH=amd64 CGO_ENABLED=0 GOOS=darwin go build -v --ldflags="$(LDFLAGS)" \
-o bin/darwin/amd64/$(CLI_EXE) $(CLI_PKG)

.PHONY: build-mac-arm64
build-mac-arm64:
GOARCH=arm64 CGO_ENABLED=0 GOOS=darwin go build -v --ldflags="$(LDFLAGS)" \
-o bin/darwin/arm64/$(CLI_EXE) $(CLI_PKG)

.PHONY: build-windows
build-windows:
GOARCH=amd64 CGO_ENABLED=0 GOOS=windows go build -v --ldflags="$(LDFLAGS)" \
Expand Down

0 comments on commit 23f76e8

Please sign in to comment.