Skip to content

Commit

Permalink
Adds github workflow for release
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmel committed Aug 21, 2024
1 parent 8ce3ddd commit 069f7a0
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 0 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
docker-image:
name: Publish Docker Image
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Get tag version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Print version
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Extract metadata (tags, labels) for Docker images
id: meta
uses: docker/metadata-action@v4
with:
images: flashbots/op-geth
tags: |
type=sha
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ !contains(env.RELEASE_VERSION, '-') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ FLASHBOTS_DOCKERHUB_USERNAME }}
password: ${{ FLASHBOTS_DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
VERSION=${{ env.RELEASE_VERSION }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-all:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.22
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --skip-publish --config .goreleaser-build.yaml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: op-geth-build
path: |
dist/op-geth*.tar.gz
dist/op-geth*.txt
release:
needs: build-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.22
- name: Make directories
run: |
mkdir -p ./build
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: op-geth-build
path: ./build
- name: Merge checksum file
run: |
cd ./build
cat ./op-geth*checksums.txt >> checksums.txt
rm ./op-geth*checksums.txt
- name: Release
uses: goreleaser/goreleaser-action@v3
with:
args: release --config .goreleaser-release.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .goreleaser-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://goreleaser.com/customization/builds/
project_name: op-geth
builds:
- id: op-geth
env:
# Force build to be all Go.
- CGO_ENABLED=0
flags:
# Remove all file system paths from the executable.
- -trimpath
ldflags:
# Disables DWARF debugging information.
- -w
# Disables symbol table information.
- -s
# Sets the value of the symbol.
- -X github.com/flashbots/op-geth/config.Version={{.Version}}
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
12 changes: 12 additions & 0 deletions .goreleaser-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://goreleaser.com/customization/release/
builds:
- skip: true
release:
draft: true
extra_files:
- glob: ./build/*
header: |
# 🚀 Features
# 🎄 Enhancements
# 🐞 Notable bug fixes
# 🎠 Community

0 comments on commit 069f7a0

Please sign in to comment.