Skip to content

Commit

Permalink
fix(gorleaser-latest): try using dir other than 'dist' since it's git…
Browse files Browse the repository at this point in the history
…ignored
  • Loading branch information
Unique-Divine committed Dec 18, 2023
1 parent 873c841 commit 8a3b7b8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/goreleaser-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -37,11 +37,21 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Move dist to prevent dockerignore"
run: |
echo "dist contents: $(ls dist)"
if [ ! -d "dist" ]; then
echo "❌ expected dist dir to be generated from make release-snapshot" && exit 1
else echo "dist dir exists as expected."
fi
rm -rf dist-temp
cp -r dist dist-temp
- name: Build and push versioned image
uses: docker/build-push-action@v5
with:
file: contrib/docker/goreleaser.Dockerfile
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/nibiruchain/nibiru:latest
tags: ghcr.io/nibiruchain/nibiru:latest
4 changes: 2 additions & 2 deletions contrib/docker/goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.21 AS builder

WORKDIR /root
COPY dist/ /root/
COPY ./dist-temp/ /root/

ARG TARGETARCH
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
Expand All @@ -17,4 +17,4 @@ RUN apk --no-cache add ca-certificates
COPY --from=builder /root/nibid /usr/local/bin/nibid

ENTRYPOINT ["nibid"]
CMD [ "start" ]
CMD [ "start" ]
14 changes: 13 additions & 1 deletion contrib/make/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
PACKAGE_NAME := github.com/NibiruChain/nibiru
GOLANG_CROSS_VERSION ?= v1.21.5

release:
verify-dist-temp:
@if [ ! -d "dist-temp" ]; then \
echo "dist-temp does not exist, please run release-snapshot first"; \
exit 1; \
fi

# The `make release` command is running a Docker container with the image
# `gorelease/goreleaser-cross:${GOLANG_CROSS_VERSION}`. This command:
# `-v "$(CURDIR)":/go/src/$(PACKAGE_NAME)`: mounts the current directory
# `release --rm-dist`: executes the release inside the directory
release: verify-dist-temp
docker run \
--rm \
--platform linux/amd64 \
Expand All @@ -26,3 +36,5 @@ release-snapshot:
-e CGO_ENABLED=1 \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --snapshot
rm -rf dist-temp
cp -r dist dist-temp

0 comments on commit 8a3b7b8

Please sign in to comment.