Skip to content

Commit

Permalink
update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaasman00 committed Jul 16, 2024
1 parent eb3f8f2 commit 8cbab65
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ jobs:
with:
go-version-file: go.mod
cache-dependency-path: "**/go.sum"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser-pro
version: "v1.22.1"
args: build --single-target --skip=validate --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Build Windows Binaries
run: make build-binaries
- name: Copy Windows Collector Binary
run: cp dist/windows_amd64/collector_windows_amd64_v1/observiq-otel-collector.exe windows/observiq-otel-collector.exe
run: cp dist/collector_windows_amd64.exe windows/observiq-otel-collector.exe
- name: Copy Windows Updater Binary
run: cp dist/windows_amd64/updater_windows_amd64_v1/updater.exe windows/updater.exe
run: cp dist/updater_windows_amd64.exe windows/updater.exe
- name: Copy Plugins to MSI Build Directory
run: cp -r release_deps/plugins windows/
- name: Copy Example Config
Expand Down
20 changes: 9 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ before:
- make release-prep CURR_VERSION={{ .Version }}
- make build-all OUTDIR="tmp"

after:
hooks:
- cmd: rm -rf tmp

# https://goreleaser.com/customization/build/
builds:
# https://goreleaser.com/customization/builds/#import-pre-built-binaries
- id: collector
builder: prebuilt
binary: observiq-otel-collector
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- windows
- linux
Expand All @@ -35,13 +40,10 @@ builds:
- goos: darwin
goarch: ppc64le
prebuilt:
path: tmp/collector_{{ .Os }}_{{ .Arch }}/observiq-otel-collector{{ .Ext }}
path: tmp/collector_{{ .Os }}_{{ .Arch }}{{ .Ext }}
- id: updater
builder: prebuilt
binary: updater
dir: ./updater/
main: ./cmd/updater
env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- windows
Expand All @@ -66,12 +68,8 @@ builds:
goarch: ppc64
- goos: darwin
goarch: ppc64le
ldflags:
- -s -w
- -X github.com/observiq/bindplane-agent/updater/internal/version.version=v{{ .Version }}
- -X github.com/observiq/bindplane-agent/updater/internal/version.gitHash={{ .FullCommit }}
- -X github.com/observiq/bindplane-agent/updater/internal/version.date={{ .Date }}
no_unique_dist_dir: false
prebuilt:
path: tmp/updater_{{ .Os }}_{{ .Arch }}{{ .Ext }}

# https://goreleaser.com/customization/archive/
archives:
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ VERSION ?= $(if $(CURRENT_TAG),$(CURRENT_TAG),$(PREVIOUS_TAG))
.PHONY: agent
agent:
builder --config="./manifests/observIQ/manifest.yaml"
mkdir -p $(OUTDIR)/collector_$(GOOS)_$(GOARCH); cp ./builder/observiq-otel-collector $(OUTDIR)/collector_$(GOOS)_$(GOARCH)/observiq-otel-collector$(EXT)
mkdir -p $(OUTDIR); cp ./builder/observiq-otel-collector $(OUTDIR)/collector_$(GOOS)_$(GOARCH)$(EXT)

# Builds a custom distro for the current GOOS/GOARCH pair using the manifest specified
# MANIFEST = path to the manifest file for the distro to be built
Expand All @@ -46,6 +46,14 @@ distro:
# TODO:(dakota) Updater likely to change and so is this cmd
.PHONY: updater
updater:
cd ./updater/; go build -ldflags "-s -w\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.version=$(VERSION)'\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.gitHash=$(shell git rev-parse HEAD)'\
-X 'github.com/observiq/bindplane-agent/updater/internal/version.date=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")'"\
-o ../$(OUTDIR)/updater_$(GOOS)_$(GOARCH)$(EXT) ./cmd/updater

.PHONY: updater-local
updater-local:
cd ./updater/; go build -o ../$(OUTDIR)/updater_$(GOOS)_$(GOARCH)$(EXT) ./cmd/updater

# Runs the supervisor invoking the agent build in /dist
Expand Down Expand Up @@ -231,6 +239,7 @@ release-prep:
@rm -rf release_deps
@mkdir release_deps
@echo 'v$(CURR_VERSION)' > release_deps/VERSION.txt
./buildscripts/download-dependencies.sh release_deps
@cp -r ./plugins release_deps/
@cp config/example.yaml release_deps/config.yaml
@cp config/logging.yaml release_deps/logging.yaml
Expand Down

0 comments on commit 8cbab65

Please sign in to comment.