Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have make update-* propose to commit any changes #14630

Merged
merged 4 commits into from
Dec 11, 2024
Merged
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
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ endif
go get toolchain@none

@echo "Dependencies updated"
if [ -t 0 ] && ! git diff --quiet -- ./go.mod ./go.sum; then \
read -rp "Would you like to commit gomod changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -S -sm "gomod: Update dependencies" -- ./go.mod ./go.sum;\
fi;\
fi


.PHONY: update-protobuf
update-protobuf:
Expand All @@ -150,11 +157,23 @@ endif
@# Generate spec and exclude package from dependency which causes a 'classifier: unknown swagger annotation "extendee"' error.
@# For more details see: https://github.com/go-swagger/go-swagger/issues/2917.
swagger generate spec -o doc/rest-api.yaml -w ./lxd -m -x github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options
if [ -t 0 ] && ! git diff --quiet -- ./doc/rest-api.yaml; then \
read -rp "Would you like to commit swagger YAML changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -S -sm "doc/rest-api: Refresh swagger YAML" -- ./doc/rest-api.yaml;\
fi;\
fi

.PHONY: update-metadata
update-metadata: build
@echo "Generating golang documentation metadata"
$(GOPATH)/bin/lxd-metadata . --json ./lxd/metadata/configuration.json --txt ./doc/metadata.txt --substitution-db ./doc/substitutions.yaml
if [ -t 0 ] && ! git diff --quiet -- ./lxd/metadata/configuration.json ./doc/metadata.txt; then \
read -rp "Would you like to commit metadata changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -S -sm "doc: Update metadata" -- ./lxd/metadata/configuration.json ./doc/metadata.txt;\
fi;\
fi

.PHONY: doc
doc: doc-clean doc-install doc-html doc-objects
Expand Down Expand Up @@ -233,7 +252,8 @@ update-po:
if [ -t 0 ] && ! git diff --quiet -- po/*.po; then \
read -rp "Would you like to commit i18n changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -sm "i18n: Update translations." -- po/*.po; fi; \
git commit -S -sm "i18n: Update translations." -- po/*.po; \
fi; \
fi

.PHONY: update-pot
Expand All @@ -246,7 +266,8 @@ endif
if [ -t 0 ] && ! git diff --quiet --ignore-matching-lines='^\s*"POT-Creation-Date: .*\n"' -- po/*.pot; then \
read -rp "Would you like to commit i18n template changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -sm "i18n: Update translation templates." -- po/*.pot; fi; \
git commit -S -sm "i18n: Update translation templates." -- po/*.pot; \
fi; \
fi

.PHONY: build-mo
Expand Down
Loading