Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release Please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.0'

- name: Install dependencies
run: go mod tidy

- name: Run Release Please
id: release
uses: GoogleCloudPlatform/release-please-action@v4
with:
release-type: go
package-name: analyzer

# Skip build & upload if no new release was created
- name: Check if release was created
if: ${{ steps.release.outputs.release_created != 'true' }}
run: echo "No release created, skipping binary build." && exit 0

- name: Build binaries
run: make build-all

- name: Generate checksums
run: |
cd bin
sha256sum * > checksums.txt

- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: |
bin/analyzer-*
bin/checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
GOLANGCI := $(GOPATH)/bin/golangci-lint
APP_NAME := analyzer
BUILD_DIR := bin
PLATFORMS := \
linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64
BINARIES := $(foreach platform,$(PLATFORMS),$(BUILD_DIR)/$(APP_NAME)-$(subst /,-,$(platform)))

.PHONY: analyzer
analyzer:
go build -o ./bin/analyzer ./main.go

.PHONY: build-all
build-all: $(BINARIES)

$(BUILD_DIR)/$(APP_NAME)-%:
@mkdir -p $(BUILD_DIR)
@GOOS=$(word 1,$(subst -, ,$*)) GOARCH=$(word 2,$(subst -, ,$*)) go build -o $@ ./main.go
@echo "Built $@"

.PHONY: get
get:
go mod download && go mod tidy
Expand Down
Loading