Skip to content

Commit

Permalink
chore(go): introduce goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Apr 2, 2024
1 parent 943a04b commit 3dfa898
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 360 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: goreleaser

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
module: [ p2p, oracle ] # bridge, external/geth
steps:
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: 1.22
cache: true

# TODO(mrekucci): Re-enable when the repo is finalized.
# - name: GHCR Docker Login
# run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v3

- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean ${{ env.flags }} --config=./${{ matrix.module }}/.goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

39 changes: 0 additions & 39 deletions oracle/.github/workflows/go-ci.yml

This file was deleted.

36 changes: 0 additions & 36 deletions oracle/.github/workflows/goreleaser.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions oracle/.goreleaser.yaml

This file was deleted.

57 changes: 57 additions & 0 deletions oracle/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 1

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
dir: ./oracle
main: ./cmd
binary: mev-commit-oracle
flags:
- -v
- -trimpath
ldflags:
- -s -w

archives:
- format: tar.gz
name_template: >-
mev-commit-oracle_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

checksum:
name_template: mev-commit-oracle_{{ .Version }}_checksums.txt

# TODO(mrekucci): Re-enable when the repo is finalized.
#dockers:
# - image_templates:
# - ghcr.io/primevprotocol/mev-commit-oracle:v{{ .Major }}.{{ .Minor }}
# - ghcr.io/primevprotocol/mev-commit-oracle:latest
# dockerfile: Dockerfile.goreleaser
# use: buildx
# goarch: amd64
# build_flag_templates:
# - "--pull"
# - "--label=org.opencontainers.image.created={{.Date}}"
# - "--label=org.opencontainers.image.title={{.ProjectName}}"
# - "--label=org.opencontainers.image.revision={{.FullCommit}}"
# - "--label=org.opencontainers.image.version={{.Version}}"
# - "--platform=linux/amd64"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
11 changes: 0 additions & 11 deletions p2p/.github/dependabot.yml

This file was deleted.

40 changes: 0 additions & 40 deletions p2p/.github/workflows/go-ci.yml

This file was deleted.

36 changes: 0 additions & 36 deletions p2p/.github/workflows/goreleaser.yaml

This file was deleted.

66 changes: 0 additions & 66 deletions p2p/.github/workflows/mev-commit-infra-test.yml

This file was deleted.

Loading

0 comments on commit 3dfa898

Please sign in to comment.