append vendor.tgz to each release (#2288)

This commit is contained in:
mmetc 2023-06-21 09:52:33 +02:00 committed by GitHub
parent f7409d47be
commit 4c4b545e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 33 deletions

View file

@ -44,11 +44,11 @@ jobs:
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Build the binaries
run: make release
run: make vendor release
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag_name="${GITHUB_REF##*/}"
hub release edit -a crowdsec-release.tgz -m "" "$tag_name"
hub release edit -a crowdsec-release.tgz -a vendor.tgz -m "" "$tag_name"

6
.gitignore vendored
View file

@ -30,8 +30,10 @@ test/coverage/*
*.swp
*.swo
# Dependency directories (remove the comment below to include it)
# vendor/
# Dependencies are not vendored by default, but a tarball is created by "make vendor"
# and provided in the release. Used by freebsd, gentoo, etc.
vendor/
vendor.tgz
# crowdsec binaries
cmd/crowdsec-cli/cscli

View file

@ -137,13 +137,25 @@ localstack:
localstack-stop:
docker-compose -f test/localstack/docker-compose.yml down
# list of plugins that contain go.mod
PLUGIN_VENDOR = $(foreach plugin,$(PLUGINS),$(shell if [ -f $(PLUGINS_DIR)/$(plugin)/go.mod ]; then echo $(PLUGINS_DIR)/$(plugin); fi))
.PHONY: vendor
vendor:
@echo "Vendoring dependencies"
@$(GOCMD) mod vendor
@$(foreach plugin,$(PLUGINS), \
$(MAKE) -C $(PLUGINS_DIR)/$(plugin) vendor $(MAKE_FLAGS); \
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
cd $(plugin_dir) >/dev/null && \
$(GOCMD) mod vendor && \
cd - >/dev/null; \
)
$(GOCMD) mod vendor
tar -czf vendor.tgz vendor $(foreach plugin_dir,$(PLUGIN_VENDOR),$(plugin_dir)/vendor)
.PHONY: vendor-remove
vendor-remove:
$(foreach plugin_dir,$(PLUGIN_VENDOR), \
$(RM) $(plugin_dir)/vendor; \
)
$(RM) vendor vendor.tgz
.PHONY: package
package:

View file

@ -16,8 +16,3 @@ build: clean
.PHONY: clean
clean:
@$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR)
.PHONY: vendor
vendor:
@echo "vendoring $(PLUGIN) plugin..."
@$(GOCMD) mod vendor

View file

@ -16,8 +16,3 @@ build: clean
.PHONY: clean
clean:
@$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR)
.PHONY: vendor
vendor:
@echo "vendoring $(PLUGIN) plugin..."
@$(GOCMD) mod vendor

View file

@ -16,8 +16,3 @@ build: clean
.PHONY: clean
clean:
@$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR)
.PHONY: vendor
vendor:
@echo "vendoring $(PLUGIN) plugin..."
@$(GOCMD) mod vendor

View file

@ -16,8 +16,3 @@ build: clean
.PHONY: clean
clean:
@$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR)
.PHONY: vendor
vendor:
@echo "vendoring $(PLUGIN) plugin..."
@$(GOCMD) mod vendor

View file

@ -16,8 +16,3 @@ build: clean
.PHONY: clean
clean:
@$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR)
.PHONY: vendor
vendor:
@echo "vendoring $(PLUGIN) plugin..."
@$(GOCMD) mod vendor