From 10a36e25ebef4229b6ca909db096534317de0277 Mon Sep 17 00:00:00 2001 From: Arun Dhyani Date: Tue, 11 Mar 2025 13:21:26 +0530 Subject: [PATCH 1/2] chore: release ci integration --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ Makefile | 17 +++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7f9a6ad --- /dev/null +++ b/.github/workflows/release.yml @@ -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.21' # Adjust this to match your Go version + + - 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 }} \ No newline at end of file diff --git a/Makefile b/Makefile index 00d6629..4188877 100644 --- a/Makefile +++ b/Makefile @@ -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 From 295b2671f3e948308d970a0e1562de9343f40de2 Mon Sep 17 00:00:00 2001 From: Arun Dhyani Date: Tue, 11 Mar 2025 13:23:32 +0530 Subject: [PATCH 2/2] update go version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f9a6ad..fe87f5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' # Adjust this to match your Go version + go-version: '1.22.0' - name: Install dependencies run: go mod tidy