Skip to content

Commit

Permalink
ci(circleci): add goreleaser job for releases
Browse files Browse the repository at this point in the history
Leverage the goreleaser-pro support for monorepo to handle releases
for the tags we use for individual components.

This resolves ethereum-optimism/platforms-team#403
  • Loading branch information
sigma committed Nov 13, 2024
1 parent b7fb6a5 commit cbb68a4
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 1 deletion.
58 changes: 57 additions & 1 deletion .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,43 @@ jobs:
- store_test_results:
path: /tmp/test-results

# TODO: this should be in an orb to improve reusability.
go-release:
parameters:
module:
description: Go Module Name
type: string
filename:
description: Goreleaser config file
default: .goreleaser.yaml
type: string
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class: large
steps:
- setup_remote_docker
- gcp-cli/install
- gcp-oidc-authenticate:
gcp_cred_config_file_path: /root/gcp_cred_config.json
oidc_token_file_path: /root/oidc_token.json
- checkout
- run:
name: Install goreleaser pro
command: |
mkdir -p /tmp/goreleaser
cd /tmp/goreleaser
curl -L -o goreleaser.tgz https://github.com/goreleaser/goreleaser-pro/releases/download/v2.4.3-pro/goreleaser-pro_Linux_x86_64.tar.gz
tar -xzvf goreleaser.tgz
mv goreleaser /usr/local/bin/goreleaser
- run:
name: Configure Docker
command: |
gcloud auth configure-docker us-docker.pkg.dev
- run:
name: Run goreleaser
command: |
goreleaser release --clean -f ./<<parameters.module>>/<<parameters.filename>>
workflows:
logging:
jobs:
Expand Down Expand Up @@ -518,7 +555,7 @@ workflows:
- proxyd
- op-conductor-mon
- peer-mgmt-service
name: <<matrix.module>>-docker-tag
name: <<matrix.docker_name>>-docker-tag
filters:
tags:
only: /^<<matrix.docker_name>>\/v.*/
Expand All @@ -528,3 +565,22 @@ workflows:
- oplabs-gcr-release
requires:
- <<matrix.docker_name>>-docker-publish
- go-release:
matrix:
parameters:
module:
- op-signer
- op-txproxy
- op-ufm
- proxyd
- op-conductor-mon
- peer-mgmt-service
name: <<matrix.module>>-go-release
filters:
tags:
only: /^<<matrix.module>>.*/
branches:
ignore: /.*/
module: <<matrix.module>>
context:
- oplabs-gcr-release
56 changes: 56 additions & 0 deletions op-conductor-mon/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: op-conductor-mon

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- id: main
main: ./cmd/monitor
binary: op-conductor-mon
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X main.Version={{ .Version }}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc

release:
github:
owner: ethereum-optimism
name: infra
make_latest: false

monorepo:
tag_prefix: op-conductor-mon/
dir: op-conductor-mon
56 changes: 56 additions & 0 deletions op-signer/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: op-signer

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- id: main
main: ./cmd
binary: op-signer
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X main.Version={{ .Version }}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc

release:
github:
owner: ethereum-optimism
name: infra
make_latest: false

monorepo:
tag_prefix: op-signer/
dir: op-signer
56 changes: 56 additions & 0 deletions op-txproxy/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: op-txproxy

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- id: main
main: ./cmd
binary: op-txproxy
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X main.Version={{ .Version }}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc

release:
github:
owner: ethereum-optimism
name: infra
make_latest: false

monorepo:
tag_prefix: op-txproxy/
dir: op-txproxy
56 changes: 56 additions & 0 deletions op-ufm/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: op-ufm

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- id: main
main: ./cmd/ufm
binary: op-ufm
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X main.Version={{ .Version }}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc

release:
github:
owner: ethereum-optimism
name: infra
make_latest: false

monorepo:
tag_prefix: op-ufm/
dir: op-ufm
56 changes: 56 additions & 0 deletions peer-mgmt-service/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: peer-mgmt-service

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- id: main
main: ./cmd/pms
binary: peer-mgmt-service
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X main.Version={{ .Version }}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc

release:
github:
owner: ethereum-optimism
name: infra
make_latest: false

monorepo:
tag_prefix: peer-mgmt-service/
dir: peer-mgmt-service
Loading

0 comments on commit cbb68a4

Please sign in to comment.