Skip to content

Commit

Permalink
build(release): update goreleaser-cross v1.19.1
Browse files Browse the repository at this point in the history
release darwin universal binaries

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Oct 6, 2022
1 parent 03749e3 commit f1e378c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANG_VERSION=1.17.6
GOLANG_VERSION=1.19.1
KIND_VERSION=0.11.1
GO111MODULE=on
ROOT_DIR=${AKASH_ROOT}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/release-dry-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: release

defaults:
run:
shell: bash

on:
push:
branches:
- master
- mainnet/main

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v2
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: branch name
id: branch_name
run: |
echo ::set-output name=MAINNET::$(./script/mainnet-from-tag.sh ${GITHUB_REF#refs/tags/})
echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
- run: echo "Building for MAINNET=${{ steps.branch_name.outputs.MAINNET }}"
- name: release dry-run
run: make release
env:
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
MAINNET: ${{ steps.branch_name.outputs.MAINNET }}
28 changes: 13 additions & 15 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ defaults:

on:
push:
branches:
- master
- mainnet/main
tags:
- v*

Expand Down Expand Up @@ -37,22 +34,23 @@ jobs:
- if: (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/mainnet/main')
name: release dry-run GORELEASER_SKIP_VALIDATE=true
run: make release-dry-run GORELEASER_SKIP_VALIDATE=true
- if: startsWith(github.ref,'refs/tags/v')
name: release dry-run
run: make release-dry-run
- name: release dry-run
run: make release
env:
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
- if: startsWith(github.ref,'refs/tags/v') && github.repository == 'ovrclk/akash'
name: setup release environment
run: |-
echo '${{secrets.GHCR_USER}}:${{secrets.GHCR_TOKEN}}:ghcr.io' > .docker-creds
echo 'DOCKER_CREDS_FILE=.docker-creds' > .release-env
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_ACCESS_TOKEN}}' >> .release-env
- if: startsWith(github.ref,'refs/tags/v') && github.repository == 'ovrclk/akash'
name: release publish
run: |-
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: release publish
run: |
sudo rm -rf dist
make release
env:
GORELEASER_RELEASE: true
MAINNET: ${{ steps.branch_name.outputs.MAINNET }}
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
# using PAT as homebrew is located in different repo
GITHUB_TOKEN: ${{ secrets.GORELEASER_ACCESS_TOKEN }}
48 changes: 44 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ builds:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
archives:
- id: akash
builds:
universal_binaries:
- id: akash-darwin-universal
ids:
- akash-darwin-amd64
- akash-darwin-arm64
replace: true
name_template: "{{.ProjectName}}"
archives:
- id: w/version
builds:
- akash-darwin-universal
- akash-linux-amd64
- akash-linux-arm64
- akash-windows-amd64
Expand All @@ -108,6 +114,30 @@ archives:
format: zip
files:
- none*
- id: wo/version
builds:
- akash-darwin-universal
- akash-linux-amd64
- akash-linux-arm64
- akash-windows-amd64
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: true
format: zip
files:
- none*
brews:
- name: "{{ .Env.HOMEBREW_NAME }}"
ids:
- wo/version
tap:
owner: ovrclk
name: homebrew-tap
homepage: "https://akash.network"
description: "Blockchain-powered decentralized compute platform"
custom_block: |
{{ .Env.HOMEBREW_CUSTOM }}
install: |
bin.install "akash"
dockers:
- dockerfile: _build/Dockerfile.akash
Expand Down Expand Up @@ -159,13 +189,23 @@ docker_manifests:
- ghcr.io/ovrclk/{{ .ProjectName }}:latest-arm64

nfpms:
- vendor: "Overclock Labs Inc."
- id: w/version
vendor: "Overclock Labs Inc."
homepage: "http://ovrclk.com"
maintainer: "Akash Network <[email protected]>"
formats:
- deb
- rpm
license: Apache 2.0
- id: wo/version
vendor: "Overclock Labs Inc."
homepage: "https://ovrclk.com"
maintainer: "Overclock Labs Inc. <[email protected]>"
file_name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
formats:
- deb
- rpm
license: Apache 2.0

release:
github:
Expand Down
2 changes: 2 additions & 0 deletions make/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ BINS := $(AKASH)

GO := GO111MODULE=$(GO111MODULE) go

GO_MOD_NAME := $(shell go list -m 2>/dev/null)

# setup .cache bins first in paths to have precedence over already installed same tools for system wide use
PATH := "$(PATH):$(AKASH_DEVCACHE_BIN):$(AKASH_DEVCACHE_NODE_BIN)"

Expand Down
52 changes: 18 additions & 34 deletions make/releasing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ GORELEASER_DEBUG ?= false
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GOLANG_VERSION)
GON_CONFIGFILE ?= gon.json

ifeq ($(GORELEASER_RELEASE),true)
GORELEASER_SKIP_VALIDATE := false
GORELEASER_SKIP_PUBLISH := release --skip-publish=false
else
GORELEASER_SKIP_PUBLISH := --skip-publish=true
GORELEASER_SKIP_VALIDATE ?= false
GITHUB_TOKEN=
endif

ifeq ($(OS),Windows_NT)
DETECTED_OS := Windows
else
Expand Down Expand Up @@ -61,37 +70,8 @@ docker-image:
gen-changelog: $(GIT_CHGLOG)
@echo "generating changelog to .cache/changelog"
./script/genchangelog.sh "$(RELEASE_TAG)" .cache/changelog.md

.PHONY: release-dry-run
release-dry-run: modvendor gen-changelog
docker run \
--rm \
--privileged \
-e STABLE=$(IS_STABLE) \
-e MOD="$(GO_MOD)" \
-e BUILD_TAGS="$(BUILD_TAGS)" \
-e BUILD_VARS="$(GORELEASER_BUILD_VARS)" \
-e STRIP_FLAGS="$(GORELEASER_STRIP_FLAGS)" \
-e LINKMODE="$(GO_LINKMODE)" \
-e HOMEBREW_NAME="$(GORELEASER_HOMEBREW_NAME)" \
-e HOMEBREW_CUSTOM="$(GORELEASER_HOMEBREW_CUSTOM)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/ovrclk/akash \
-w /go/src/github.com/ovrclk/akash \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" \
--skip-validate=$(GORELEASER_SKIP_VALIDATE) \
--debug=$(GORELEASER_DEBUG) \
--rm-dist \
--skip-publish \
--release-notes=/go/src/github.com/ovrclk/akash/.cache/changelog.md

.PHONY: release
release: modvendor gen-changelog
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
Expand All @@ -103,12 +83,16 @@ release: modvendor gen-changelog
-e LINKMODE="$(GO_LINKMODE)" \
-e HOMEBREW_NAME="$(GORELEASER_HOMEBREW_NAME)" \
-e HOMEBREW_CUSTOM="$(GORELEASER_HOMEBREW_CUSTOM)" \
--env-file .release-env \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-e GORELEASER_CURRENT_TAG="$(RELEASE_TAG)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/ovrclk/akash \
-w /go/src/github.com/ovrclk/akash \
-v $(HOME)/.docker/config.json:/root/.docker/config.json \
-v `pwd`:/go/src/$(GO_MOD_NAME) \
-w /go/src/$(GO_MOD_NAME) \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" release \
-f "$(GORELEASER_CONFIG)" \
$(GORELEASER_SKIP_PUBLISH) \
--skip-validate=$(GORELEASER_SKIP_VALIDATE) \
--debug=$(GORELEASER_DEBUG) \
--rm-dist \
--release-notes=/go/src/github.com/ovrclk/akash/.cache/changelog.md
--release-notes=/go/src/$(GO_MOD_NAME)/.cache/changelog.md

0 comments on commit f1e378c

Please sign in to comment.