Skip to content

Commit e782926

Browse files
committed
Migrate ocb binary release to opentelemetry-collector-releases #608
1 parent 5342205 commit e782926

File tree

5 files changed

+146
-2
lines changed

5 files changed

+146
-2
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Builder - Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
jobs:
8+
goreleaser:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Releases Repo
12+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
13+
with:
14+
fetch-depth: 0
15+
- run: ls -la
16+
- name: Push cmd/builder Tag
17+
run: |
18+
tag="cmd/builder/${{ github.ref_name }}"
19+
message="Releasing ocb binaries for ${{ github.ref_name }}"
20+
git config user.name "${GITHUB_ACTOR}"
21+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
22+
git tag -a "${tag}" -m "${message}"
23+
git push origin "${tag}"
24+
- name: Checkout Core Repo
25+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
with:
27+
fetch-depth: 0
28+
repository: "open-telemetry/opentelemetry-collector"
29+
ref: ${{ github.ref_name }}
30+
path: ".core"
31+
- name: Setup Go
32+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
33+
with:
34+
go-version: ~1.21.5
35+
- name: Run GoReleaser
36+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
37+
with:
38+
distribution: goreleaser-pro
39+
version: latest
40+
args: release --clean -f cmd/builder/.goreleaser.yml
41+
env:
42+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Builder - Check and Test Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "distributions/otelcol-contrib/**"
8+
- "cmd/**"
9+
- ".github/**"
10+
- "scripts/**"
11+
- "Makefile"
12+
- "go.mod"
13+
- "go.sum"
14+
pull_request:
15+
branches: [main]
16+
paths:
17+
- "distributions/otelcol-contrib/**"
18+
- "cmd/**"
19+
- ".github/**"
20+
- "scripts/**"
21+
- "Makefile"
22+
- "go.mod"
23+
- "go.sum"
24+
25+
jobs:
26+
check-goreleaser:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout Releases Repo
30+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
31+
with:
32+
fetch-depth: 0
33+
repository: "open-telemetry/opentelemetry-collector-releases"
34+
- name: Checkout Core Repo
35+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
36+
with:
37+
fetch-depth: 0
38+
repository: "open-telemetry/opentelemetry-collector"
39+
path: ".core"
40+
- name: Setup Go
41+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
42+
with:
43+
go-version: ~1.21.5
44+
- name: Check GoReleaser
45+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
46+
with:
47+
distribution: goreleaser-pro
48+
version: latest
49+
args: check --verbose -f cmd/builder/.goreleaser.yml
50+
env:
51+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Run GoReleaser
54+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
55+
with:
56+
distribution: goreleaser-pro
57+
version: latest
58+
args: --snapshot --clean -f cmd/builder/.goreleaser.yml
59+
env:
60+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/
44
.idea
55
.generated-yaml/
66
.vscode
7+
.core

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ ifeq (, $(shell command -v ocb 2>/dev/null))
4040
[ "$${machine}" != x86_64 ] || machine=amd64 ;\
4141
echo "Installing ocb ($${os}/$${machine}) at $(OTELCOL_BUILDER_DIR)";\
4242
mkdir -p $(OTELCOL_BUILDER_DIR) ;\
43-
curl -sfLo $(OTELCOL_BUILDER) "https://github.com/open-telemetry/opentelemetry-collector/releases/download/cmd%2Fbuilder%2Fv$(OTELCOL_BUILDER_VERSION)/ocb_$(OTELCOL_BUILDER_VERSION)_$${os}_$${machine}" ;\
44-
chmod +x $(OTELCOL_BUILDER) ;\
43+
go install go.opentelemetry.io/collector/cmd/builder@v$(OTELCOL_BUILDER_VERSION) ;\
44+
mv $$(go env GOPATH)/bin/builder $(OTELCOL_BUILDER) ;\
4545
}
4646
else
4747
OTELCOL_BUILDER=$(shell command -v ocb)

cmd/builder/.goreleaser.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
monorepo:
5+
tag_prefix: cmd/builder/
6+
dir: .core/cmd/builder
7+
builds:
8+
- flags:
9+
- -trimpath
10+
ldflags:
11+
- -s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{.Version}} -X go.opentelemetry.io/collector/cmd/builder/internal.date={{.Date}}
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
- windows
17+
- darwin
18+
goarch:
19+
- amd64
20+
- arm64
21+
- ppc64le
22+
ignore:
23+
- goos: windows
24+
goarch: arm64
25+
binary: ocb
26+
release:
27+
github:
28+
owner: open-telemetry
29+
name: opentelemetry-collector-releases
30+
header: |
31+
### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }}
32+
archives:
33+
- format: binary
34+
checksum:
35+
name_template: "checksums.txt"
36+
snapshot:
37+
name_template: "{{ .Tag }}-next"
38+
changelog:
39+
disable: true

0 commit comments

Comments
 (0)