Skip to content

Commit 45d537b

Browse files
committed
add make target for release and clean
1 parent cfdfe3e commit 45d537b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Makefile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
GITHUB_REPO := vigetlabs/terraform-module-viget-sso-access
2+
FILES_TO_COMPRESS := outputs.tf roles.tf saml_providers.tf variables.tf versions.tf
3+
GITHUB_CLI := gh
4+
15
.DEFAULT_GOAL = help
2-
EXECUTABLE_DEPS = terraform-docs
6+
EXECUTABLE_DEPS = terraform-docs gh jq
37

48
# Test for executable dependencies
59
K := $(foreach exec,$(EXECUTABLE_DEPS),\
@@ -26,3 +30,23 @@ help:
2630
## Generate terraform documentation and add to README.md
2731
docs:
2832
terraform-docs -c .terraform.docs.yml .
33+
34+
## Release a new version of the module
35+
release: # TODO: clean this up and automate better
36+
# Set the release tag and version
37+
$(eval TAG := $(shell git describe --tags --abbrev=0))
38+
$(eval VERSION := $(shell git describe --tags))
39+
40+
# Create a GitHub release
41+
$(GITHUB_CLI) release create $(VERSION) --repo $(GITHUB_REPO) --title "$(VERSION)" --notes "Release $(VERSION)" --draft
42+
43+
# Compress the list of files
44+
mkdir -p dist
45+
tar -czvf dist/$(TAG).tar.gz $(FILES_TO_COMPRESS)
46+
47+
# Upload the compressed archive to the GitHub release
48+
$(GITHUB_CLI) release upload $(VERSION) --repo $(GITHUB_REPO) dist/$(TAG).tar.gz
49+
50+
## Clean up generated files
51+
clean:
52+
rm -rf dist

0 commit comments

Comments
 (0)