Skip to content

Commit

Permalink
Merge pull request ava-labs#180 from ava-labs/release-job
Browse files Browse the repository at this point in the history
Release Job
  • Loading branch information
cam-schultz authored Feb 14, 2024
2 parents fcaf1b5 + d54374b commit 5dae5eb
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 43 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/release.yaml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright (C) 2024, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.

name: Release

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: awm-relayer

- name: Set Go version
run: |
source ./awm-relayer/scripts/versions.sh
echo GO_VERSION=$GO_VERSION >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Set up arm64 cross compiler
run: |
sudo apt-get -y update
sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Checkout osxcross
uses: actions/checkout@v3
with:
repository: tpoechtrager/osxcross
path: osxcross

- name: Build osxcross
run: |
sudo apt-get -y install clang llvm-dev libxml2-dev uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio libbz2-dev
cd osxcross
wget https://github.com/joseluisq/macosx-sdks/releases/download/12.3/$MACOS_SDK_FNAME -O tarballs/$MACOS_SDK_FNAME
echo $MACOS_SDK_CHECKSUM tarballs/$MACOS_SDK_FNAME | sha256sum -c -
UNATTENDED=1 ./build.sh
echo $PWD/target/bin >> $GITHUB_PATH
env:
MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz
MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
workdir: ./awm-relayer/
env:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERFILE: ./Dockerfile.release
57 changes: 57 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ref. https://goreleaser.com/customization/build/
builds:
- id: awm-relayer
main: ./main/main.go
binary: awm-relayer
flags:
- -v
# windows is ignored by default, as the `goos` field by default only
# contains linux and darwin
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
- CGO_CFLAGS=-O -D__BLST_PORTABLE__ # Set the CGO flags to use the portable version of BLST
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc
- goos: darwin
goarch: arm64
env:
- CC=oa64-clang
ignore:
- goos: darwin
goarch: amd64
dockers:
- image_templates:
- 'avaplatform/awm-relayer:{{ .Tag }}-amd64'
dockerfile: "{{ .Env.DOCKERFILE }}"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- image_templates:
- 'avaplatform/awm-relayer:{{ .Tag }}-arm64'
dockerfile: "{{ .Env.DOCKERFILE }}"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
goarch: arm64
docker_manifests:
- name_template: 'avaplatform/awm-relayer:{{ .Tag }}'
image_templates:
- 'avaplatform/awm-relayer:{{ .Tag }}-amd64'
- 'avaplatform/awm-relayer:{{ .Tag }}-arm64'
release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL or empty if its private hosted.
github:
owner: ava-labs
name: awm-relayer
3 changes: 3 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian:11-slim
COPY awm-relayer /usr/bin/awm-relayer
ENTRYPOINT [ "/usr/bin/awm-relayer" ]

0 comments on commit 5dae5eb

Please sign in to comment.