-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_github.mk
More file actions
21 lines (19 loc) · 771 Bytes
/
_github.mk
File metadata and controls
21 lines (19 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
define GITHUB_CHECK_LATEST_RELEASE
{ \
v="$$(gh api --jq '.tag_name' repos/$($(1))/releases/latest)"; \
if [ "$$v" != "$($(2))" ]; then echo "$(2) := $$v"; fi; \
};
endef
define GITHUB_CHECK_LATEST_TAG
{ \
v="$$(gh api --jq '.[].ref' repos/$($(1))/git/refs/tag | sed -ne 's|refs/tags/||p' | sort --version-sort | tail -1)"; \
if [ "$$v" != "$($(2))" ]; then echo "$(2) := $$v"; fi; \
};
endef
.PHONY: update-github
## Check for updates of %_VERSION/%_GITHUB
update-github:
@$(foreach repo_var,$(filter %_GITHUB,$(.VARIABLES)),\
$(call GITHUB_CHECK_LATEST_RELEASE,$(repo_var),$(repo_var:_GITHUB=_VERSION)))
@$(foreach repo_var,$(filter %_GITHUB_LASTTAG,$(.VARIABLES)),\
$(call GITHUB_CHECK_LATEST_TAG,$(repo_var),$(repo_var:_GITHUB_LASTTAG=_VERSION)))